pr42729.ll
3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
; RUN: opt -mtriple=thumbv7-unknown-linux-android -arm-parallel-dsp -S %s -o - | FileCheck %s
; CHECK-LABEL: undef_no_return
; CHECK: [[CAST_A:%[^ ]+]] = bitcast i16* %incdec.ptr21 to i32*
; CHECK: [[LOAD_A:%[^ ]+]] = load i32, i32* [[CAST_A]], align 2
; CHECK: %uglygep15 = getelementptr i8, i8* undef, i32 undef
; CHECK: [[GEP8:%[^ ]+]] = getelementptr i8, i8* undef, i32 undef
; CHECK: [[CAST_GEP8:%[^ ]+]] = bitcast i8* [[GEP8]] to i16*
; CHECK: [[GEP16:%[^ ]+]] = getelementptr i16, i16* [[CAST_GEP8]], i32 6
; CHECK: [[CAST_GEP16:%[^ ]+]] = bitcast i16* [[GEP16]] to i32*
; CHECK: [[LOAD_UNDEF:%[^ ]+]] = load i32, i32* [[CAST_GEP16]], align 2
; CHECK: call i32 @llvm.arm.smladx(i32 [[LOAD_UNDEF]], i32 [[LOAD_A]], i32 undef)
define void @undef_no_return(i16* %a) {
entry:
%incdec.ptr21 = getelementptr inbounds i16, i16* %a, i32 3
%incdec.ptr29 = getelementptr inbounds i16, i16* %a, i32 4
br label %for.body
for.body:
%0 = load i16, i16* %incdec.ptr21, align 2
%conv25 = sext i16 %0 to i32
%uglygep15 = getelementptr i8, i8* undef, i32 undef
%uglygep1516 = bitcast i8* %uglygep15 to i16*
%scevgep17 = getelementptr i16, i16* %uglygep1516, i32 7
%1 = load i16, i16* %scevgep17, align 2
%conv31 = sext i16 %1 to i32
%2 = load i16, i16* %incdec.ptr29, align 2
%conv33 = sext i16 %2 to i32
%uglygep12 = getelementptr i8, i8* undef, i32 undef
%uglygep1213 = bitcast i8* %uglygep12 to i16*
%scevgep14 = getelementptr i16, i16* %uglygep1213, i32 6
%3 = load i16, i16* %scevgep14, align 2
%conv39 = sext i16 %3 to i32
%mul.i287.neg.neg = mul nsw i32 %conv31, %conv25
%mul.i283.neg.neg = mul nsw i32 %conv39, %conv33
%reass.add408 = add i32 undef, %mul.i287.neg.neg
%reass.add409 = add i32 %reass.add408, %mul.i283.neg.neg
br label %for.body
}
; CHECK-LABEL: return
; CHECK: phi i32 [ %N, %entry ]
; CHECK: [[ACC:%[^ ]+]] = phi i32 [ 0, %entry ], [ [[ACC_NEXT:%[^ ]+]], %for.body ]
; CHECK: [[CAST_A:%[^ ]+]] = bitcast i16* %incdec.ptr21 to i32*
; CHECK: [[LOAD_A:%[^ ]+]] = load i32, i32* [[CAST_A]], align 2
; CHECK: [[GEP8:%[^ ]+]] = getelementptr i8, i8* %b, i32 0
; CHECK: [[CAST_GEP8:%[^ ]+]] = bitcast i8* [[GEP8]] to i16*
; CHECK: [[GEP16:%[^ ]+]] = getelementptr i16, i16* [[CAST_GEP8]], i32 %iv
; CHECK: [[CAST_GEP16:%[^ ]+]] = bitcast i16* [[GEP16]] to i32*
; CHECK: [[LOAD_B:%[^ ]+]] = load i32, i32* [[CAST_GEP16]], align 2
; CHECK: [[ACC_NEXT]] = call i32 @llvm.arm.smladx(i32 [[LOAD_B]], i32 [[LOAD_A]], i32 [[ACC]])
define i32 @return(i16* %a, i8* %b, i32 %N) {
entry:
%incdec.ptr21 = getelementptr inbounds i16, i16* %a, i32 3
%incdec.ptr29 = getelementptr inbounds i16, i16* %a, i32 4
br label %for.body
for.body:
%iv = phi i32 [ %N, %entry ], [ %iv.next, %for.body ]
%acc = phi i32 [ 0, %entry ], [ %reass.add409, %for.body ]
%0 = load i16, i16* %incdec.ptr21, align 2
%conv25 = sext i16 %0 to i32
%uglygep15 = getelementptr i8, i8* %b, i32 0
%uglygep1516 = bitcast i8* %uglygep15 to i16*
%b.idx = add nuw nsw i32 %iv, 1
%scevgep17 = getelementptr i16, i16* %uglygep1516, i32 %b.idx
%scevgep14 = getelementptr i16, i16* %uglygep1516, i32 %iv
%1 = load i16, i16* %scevgep17, align 2
%conv31 = sext i16 %1 to i32
%2 = load i16, i16* %incdec.ptr29, align 2
%conv33 = sext i16 %2 to i32
%3 = load i16, i16* %scevgep14, align 2
%conv39 = sext i16 %3 to i32
%mul.i287.neg.neg = mul nsw i32 %conv31, %conv25
%mul.i283.neg.neg = mul nsw i32 %conv39, %conv33
%reass.add408 = add i32 %acc, %mul.i287.neg.neg
%reass.add409 = add i32 %reass.add408, %mul.i283.neg.neg
%iv.next = add nuw nsw i32 %iv, -1
%cmp = icmp ne i32 %iv.next, 0
br i1 %cmp, label %for.body, label %exit
exit:
ret i32 %reass.add409
}