Home | History | Annotate | Download | only in ARM
      1 ; RUN: opt -mtriple=arm-arm-eabi -mcpu=cortex-m33 < %s -arm-parallel-dsp -S | FileCheck %s
      2 ;
      3 ; Mul with operands that are not simple load and sext/zext chains: this is not
      4 ; yet supported so the rewrite shouldn't trigger (but we do want to support this
      5 ; soon).
      6 ;
      7 ; CHECK-NOT:  call i32 @llvm.arm.smlad
      8 ;
      9 define dso_local i32 @test(i32 %arg, i32* nocapture readnone %arg1, i16* nocapture readonly %arg2, i16* nocapture readonly %arg3, i16* %arg4) {
     10 entry:
     11   %cmp24 = icmp sgt i32 %arg, 0
     12   br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
     13 
     14 for.body.preheader:
     15   %.pre = load i16, i16* %arg3, align 2
     16   %.pre27 = load i16, i16* %arg2, align 2
     17   %gep0 = getelementptr inbounds i16, i16* %arg4, i32 0
     18   %gep1 = getelementptr inbounds i16, i16* %arg4, i32 1
     19   %.add4 = load i16, i16* %gep0, align 2
     20   %.add5 = load i16, i16* %gep1, align 2
     21   %.zext4 = zext i16 %.add4 to i32
     22   %.zext5 = zext i16 %.add5 to i32
     23   br label %for.body
     24 
     25 for.cond.cleanup:
     26   %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
     27   ret i32 %mac1.0.lcssa
     28 
     29 for.body:
     30   %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
     31   %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
     32   %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
     33   %0 = load i16, i16* %arrayidx, align 2
     34   %add = add nuw nsw i32 %i.025, 1
     35   %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
     36   %1 = load i16, i16* %arrayidx1, align 2
     37   %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
     38   %2 = load i16, i16* %arrayidx3, align 2
     39   %conv = sext i16 %2 to i32
     40   %conv4 = sext i16 %0 to i32
     41   %add1 = add i32 %conv, %.zext4
     42 
     43 ; This mul has a more complicated pattern as an operand, %add1
     44 ; is another add and load, which we don't support for now.
     45   %mul = mul nsw i32 %add1, %conv4
     46   %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
     47   %3 = load i16, i16* %arrayidx6, align 2
     48   %conv7 = sext i16 %3 to i32
     49   %conv8 = sext i16 %1 to i32
     50   %add2 = add i32 %conv7, %.zext5
     51 
     52 ; Same here
     53   %mul9 = mul nsw i32 %add2, %conv8
     54   %add10 = add i32 %mul, %mac1.026
     55 
     56   %add11 = add i32 %mul9, %add10
     57   %exitcond = icmp ne i32 %add, %arg
     58   br i1 %exitcond, label %for.body, label %for.cond.cleanup
     59 }
     60