1; RUN: opt -mtriple=arm-arm-eabi -mcpu=cortex-m33 < %s -arm-parallel-dsp -S | FileCheck %s
2;
3; The loads are not narrow loads: check that the rewrite isn't triggered.
4;
5; CHECK-NOT:  call i32 @llvm.arm.smlad
6;
7; Arg2 is now an i32, while Arg3 is still and i16:
8;
9define dso_local i32 @test(i32 %arg, i32* nocapture readnone %arg1, i32* nocapture readonly %arg2, i16* nocapture readonly %arg3) {
10entry:
11  %cmp22 = icmp sgt i32 %arg, 0
12  br i1 %cmp22, label %for.body.preheader, label %for.cond.cleanup
13
14for.body.preheader:
15  %.pre = load i16, i16* %arg3, align 2
16  br label %for.body
17
18for.cond.cleanup:
19  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add9, %for.body ]
20  ret i32 %mac1.0.lcssa
21
22for.body:
23  %0 = phi i16 [ %1, %for.body ], [ %.pre, %for.body.preheader ]
24  %mac1.024 = phi i32 [ %add9, %for.body ], [ 0, %for.body.preheader ]
25  %i.023 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
26  %add = add nuw nsw i32 %i.023, 1
27  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
28  %1 = load i16, i16* %arrayidx1, align 2
29  %conv = sext i16 %0 to i32
30
31; This is a 'normal' i32 load to %2:
32  %arrayidx3 = getelementptr inbounds i32, i32* %arg2, i32 %i.023
33  %2 = load i32, i32* %arrayidx3, align 4
34
35; This mul has now 1 operand which is a narrow load, and the other a normal
36; i32 load:
37  %mul = mul nsw i32 %2, %conv
38
39  %add4 = add nuw nsw i32 %i.023, 2
40  %arrayidx5 = getelementptr inbounds i32, i32* %arg2, i32 %add4
41  %3 = load i32, i32* %arrayidx5, align 4
42  %conv6 = sext i16 %1 to i32
43  %mul7 = mul nsw i32 %3, %conv6
44  %add8 = add i32 %mul, %mac1.024
45  %add9 = add i32 %add8, %mul7
46  %exitcond = icmp eq i32 %add, %arg
47  br i1 %exitcond, label %for.cond.cleanup, label %for.body
48}
49