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 call void @llvm.lifetime.start.p0(i64 4, ptr %x) #3
12 call void @foo(ptr nonnull %x) #3
13 %0 = load i32, ptr %x, align 4, !tbaa !1
14 %inc = add nsw i32 %0, 1
15 store i32 %inc, ptr %x, align 4, !tbaa !1
16 call void @foo(ptr nonnull %x) #3
17 call void @llvm.lifetime.end.p0(i64 4, ptr %x) #3
22 ; CHECK: memw(r29+#{{[0-9]+}}) -= #1
23 define void @test1() #0 {
25 %x = alloca i32, align 4
26 call void @llvm.lifetime.start.p0(i64 4, ptr %x) #3
27 call void @foo(ptr nonnull %x) #3
28 %0 = load i32, ptr %x, align 4, !tbaa !1
29 %inc = sub nsw i32 %0, 1
30 store i32 %inc, ptr %x, align 4, !tbaa !1
31 call void @foo(ptr nonnull %x) #3
32 call void @llvm.lifetime.end.p0(i64 4, ptr %x) #3
37 ; CHECK: memw(r29+#{{[0-9]+}}) = setbit(#0)
38 define void @test2() #0 {
40 %x = alloca i32, align 4
41 call void @llvm.lifetime.start.p0(i64 4, ptr %x) #3
42 call void @foo(ptr nonnull %x) #3
43 %0 = load i32, ptr %x, align 4, !tbaa !1
45 store i32 %inc, ptr %x, align 4, !tbaa !1
46 call void @foo(ptr nonnull %x) #3
47 call void @llvm.lifetime.end.p0(i64 4, ptr %x) #3
52 ; CHECK: memw(r29+#{{[0-9]+}}) = clrbit(#0)
53 define void @test3() #0 {
55 %x = alloca i32, align 4
56 call void @llvm.lifetime.start.p0(i64 4, ptr %x) #3
57 call void @foo(ptr nonnull %x) #3
58 %0 = load i32, ptr %x, align 4, !tbaa !1
60 store i32 %inc, ptr %x, align 4, !tbaa !1
61 call void @foo(ptr nonnull %x) #3
62 call void @llvm.lifetime.end.p0(i64 4, ptr %x) #3
67 ; CHECK: memw(r29+#{{[0-9]+}}) += r
68 define void @test4(i32 %a) #0 {
70 %x = alloca i32, align 4
71 call void @llvm.lifetime.start.p0(i64 4, ptr %x) #3
72 call void @foo(ptr nonnull %x) #3
73 %0 = load i32, ptr %x, align 4, !tbaa !1
74 %inc = add nsw i32 %0, %a
75 store i32 %inc, ptr %x, align 4, !tbaa !1
76 call void @foo(ptr nonnull %x) #3
77 call void @llvm.lifetime.end.p0(i64 4, ptr %x) #3
82 ; CHECK: memw(r29+#{{[0-9]+}}) -= r
83 define void @test5(i32 %a) #0 {
85 %x = alloca i32, align 4
86 call void @llvm.lifetime.start.p0(i64 4, ptr %x) #3
87 call void @foo(ptr nonnull %x) #3
88 %0 = load i32, ptr %x, align 4, !tbaa !1
89 %inc = sub nsw i32 %0, %a
90 store i32 %inc, ptr %x, align 4, !tbaa !1
91 call void @foo(ptr nonnull %x) #3
92 call void @llvm.lifetime.end.p0(i64 4, ptr %x) #3
97 ; CHECK: memw(r29+#{{[0-9]+}}) |= r
98 define void @test6(i32 %a) #0 {
100 %x = alloca i32, align 4
101 call void @llvm.lifetime.start.p0(i64 4, ptr %x) #3
102 call void @foo(ptr nonnull %x) #3
103 %0 = load i32, ptr %x, align 4, !tbaa !1
105 store i32 %inc, ptr %x, align 4, !tbaa !1
106 call void @foo(ptr nonnull %x) #3
107 call void @llvm.lifetime.end.p0(i64 4, ptr %x) #3
112 ; CHECK: memw(r29+#{{[0-9]+}}) &= r
113 define void @test7(i32 %a) #0 {
115 %x = alloca i32, align 4
116 call void @llvm.lifetime.start.p0(i64 4, ptr %x) #3
117 call void @foo(ptr nonnull %x) #3
118 %0 = load i32, ptr %x, align 4, !tbaa !1
119 %inc = and i32 %0, %a
120 store i32 %inc, ptr %x, align 4, !tbaa !1
121 call void @foo(ptr nonnull %x) #3
122 call void @llvm.lifetime.end.p0(i64 4, ptr %x) #3
127 declare void @foo(ptr) #2
128 declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1
129 declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1
131 attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "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" }
132 attributes #1 = { argmemonly nounwind }
133 attributes #2 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "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" }
134 attributes #3 = { nounwind }
136 !1 = !{!2, !2, i64 0}
137 !2 = !{!"int", !3, i64 0}
138 !3 = !{!"omnipotent char", !4, i64 0}
139 !4 = !{!"Simple C/C++ TBAA"}