1 ; RUN: llc -march=hexagon < %s | FileCheck %s 2 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" 5 6 ; CHECK-LABEL: test0 7 ; CHECK: memw(r29+#{{[0-9]+}}) += #1 8 define void @test0() #0 { 9 entry: 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 19 ret void 20 } 21 22 ; CHECK-LABEL: test1 23 ; CHECK: memw(r29+#{{[0-9]+}}) -= #1 24 define void @test1() #0 { 25 entry: 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 35 ret void 36 } 37 38 ; CHECK-LABEL: test2 39 ; CHECK: memw(r29+#{{[0-9]+}}) = setbit(#0) 40 define void @test2() #0 { 41 entry: 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 47 %inc = or i32 %1, 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 51 ret void 52 } 53 54 ; CHECK-LABEL: test3 55 ; CHECK: memw(r29+#{{[0-9]+}}) = clrbit(#0) 56 define void @test3() #0 { 57 entry: 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 63 %inc = and i32 %1, -2 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 67 ret void 68 } 69 70 ; CHECK-LABEL: test4 71 ; CHECK: memw(r29+#{{[0-9]+}}) += r 72 define void @test4(i32 %a) #0 { 73 entry: 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 83 ret void 84 } 85 86 ; CHECK-LABEL: test5 87 ; CHECK: memw(r29+#{{[0-9]+}}) -= r 88 define void @test5(i32 %a) #0 { 89 entry: 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 99 ret void 100 } 101 102 ; CHECK-LABEL: test6 103 ; CHECK: memw(r29+#{{[0-9]+}}) |= r 104 define void @test6(i32 %a) #0 { 105 entry: 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 111 %inc = or i32 %1, %a 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 115 ret void 116 } 117 118 ; CHECK-LABEL: test7 119 ; CHECK: memw(r29+#{{[0-9]+}}) &= r 120 define void @test7(i32 %a) #0 { 121 entry: 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 131 ret void 132 } 133 134 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 138 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 } 143 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"} 148