1 ; RUN: llc -march=hexagon < %s | FileCheck %s
3 target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
4 target triple = "hexagon"
7 ; CHECK: memw(r29+#{{[0-9]+}}) += #1
8 define void @test0() #0 {
10 %x = alloca i32, align 4
11 %0 = bitcast i32* %x to i8*
12 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #3
13 call void @foo(i32* nonnull %x) #3
14 %1 = load i32, i32* %x, align 4, !tbaa !1
15 %inc = add nsw i32 %1, 1
16 store i32 %inc, i32* %x, align 4, !tbaa !1
17 call void @foo(i32* nonnull %x) #3
18 call void @llvm.lifetime.end.p0i8(i64 4, i8* %0) #3
23 ; CHECK: memw(r29+#{{[0-9]+}}) -= #1
24 define void @test1() #0 {
26 %x = alloca i32, align 4
27 %0 = bitcast i32* %x to i8*
28 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #3
29 call void @foo(i32* nonnull %x) #3
30 %1 = load i32, i32* %x, align 4, !tbaa !1
31 %inc = sub nsw i32 %1, 1
32 store i32 %inc, i32* %x, align 4, !tbaa !1
33 call void @foo(i32* nonnull %x) #3
34 call void @llvm.lifetime.end.p0i8(i64 4, i8* %0) #3
39 ; CHECK: memw(r29+#{{[0-9]+}}) = setbit(#0)
40 define void @test2() #0 {
42 %x = alloca i32, align 4
43 %0 = bitcast i32* %x to i8*
44 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #3
45 call void @foo(i32* nonnull %x) #3
46 %1 = load i32, i32* %x, align 4, !tbaa !1
48 store i32 %inc, i32* %x, align 4, !tbaa !1
49 call void @foo(i32* nonnull %x) #3
50 call void @llvm.lifetime.end.p0i8(i64 4, i8* %0) #3
55 ; CHECK: memw(r29+#{{[0-9]+}}) = clrbit(#0)
56 define void @test3() #0 {
58 %x = alloca i32, align 4
59 %0 = bitcast i32* %x to i8*
60 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #3
61 call void @foo(i32* nonnull %x) #3
62 %1 = load i32, i32* %x, align 4, !tbaa !1
64 store i32 %inc, i32* %x, align 4, !tbaa !1
65 call void @foo(i32* nonnull %x) #3
66 call void @llvm.lifetime.end.p0i8(i64 4, i8* %0) #3
71 ; CHECK: memw(r29+#{{[0-9]+}}) += r
72 define void @test4(i32 %a) #0 {
74 %x = alloca i32, align 4
75 %0 = bitcast i32* %x to i8*
76 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #3
77 call void @foo(i32* nonnull %x) #3
78 %1 = load i32, i32* %x, align 4, !tbaa !1
79 %inc = add nsw i32 %1, %a
80 store i32 %inc, i32* %x, align 4, !tbaa !1
81 call void @foo(i32* nonnull %x) #3
82 call void @llvm.lifetime.end.p0i8(i64 4, i8* %0) #3
87 ; CHECK: memw(r29+#{{[0-9]+}}) -= r
88 define void @test5(i32 %a) #0 {
90 %x = alloca i32, align 4
91 %0 = bitcast i32* %x to i8*
92 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #3
93 call void @foo(i32* nonnull %x) #3
94 %1 = load i32, i32* %x, align 4, !tbaa !1
95 %inc = sub nsw i32 %1, %a
96 store i32 %inc, i32* %x, align 4, !tbaa !1
97 call void @foo(i32* nonnull %x) #3
98 call void @llvm.lifetime.end.p0i8(i64 4, i8* %0) #3
103 ; CHECK: memw(r29+#{{[0-9]+}}) |= r
104 define void @test6(i32 %a) #0 {
106 %x = alloca i32, align 4
107 %0 = bitcast i32* %x to i8*
108 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #3
109 call void @foo(i32* nonnull %x) #3
110 %1 = load i32, i32* %x, align 4, !tbaa !1
112 store i32 %inc, i32* %x, align 4, !tbaa !1
113 call void @foo(i32* nonnull %x) #3
114 call void @llvm.lifetime.end.p0i8(i64 4, i8* %0) #3
119 ; CHECK: memw(r29+#{{[0-9]+}}) &= r
120 define void @test7(i32 %a) #0 {
122 %x = alloca i32, align 4
123 %0 = bitcast i32* %x to i8*
124 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #3
125 call void @foo(i32* nonnull %x) #3
126 %1 = load i32, i32* %x, align 4, !tbaa !1
127 %inc = and i32 %1, %a
128 store i32 %inc, i32* %x, align 4, !tbaa !1
129 call void @foo(i32* nonnull %x) #3
130 call void @llvm.lifetime.end.p0i8(i64 4, i8* %0) #3
135 declare void @foo(i32*) #2
136 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
137 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
139 attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-length64b" "unsafe-fp-math"="false" "use-soft-float"="false" }
140 attributes #1 = { argmemonly nounwind }
141 attributes #2 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-length64b" "unsafe-fp-math"="false" "use-soft-float"="false" }
142 attributes #3 = { nounwind }
144 !1 = !{!2, !2, i64 0}
145 !2 = !{!"int", !3, i64 0}
146 !3 = !{!"omnipotent char", !4, i64 0}
147 !4 = !{!"Simple C/C++ TBAA"}