brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.9 KiB · 2580d35 Raw
304 lines · plain
1; RUN: llc -debugify-and-strip-all-safe -verify-machineinstrs %s -o - -mtriple=arm64-apple-ios7.0 | FileCheck %s2; RUN: llc -debugify-and-strip-all-safe -verify-machineinstrs %s -o - -mtriple=arm64-apple-ios7.0 -global-isel -pass-remarks-missed=gisel* 2>&1 | FileCheck %s --check-prefixes=CHECK,FALLBACK3 4; FALLBACK-NOT: remark5 6@var32 = global i32 07@var64 = global i64 08 9define void @test_lsl_arith(i32 %lhs32, i32 %rhs32, i64 %lhs64, i64 %rhs64) {10; CHECK-LABEL: test_lsl_arith:11 12  %rhs1 = load volatile i32, ptr @var3213  %shift1 = shl i32 %rhs1, 1814  %val1 = add i32 %lhs32, %shift115  store volatile i32 %val1, ptr @var3216; CHECK: add {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, lsl #1817 18  %rhs2 = load volatile i32, ptr @var3219  %shift2 = shl i32 %rhs2, 3120  %val2 = add i32 %shift2, %lhs3221  store volatile i32 %val2, ptr @var3222; CHECK: add {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, lsl #3123 24  %rhs3 = load volatile i32, ptr @var3225  %shift3 = shl i32 %rhs3, 526  %val3 = sub i32 %lhs32, %shift327  store volatile i32 %val3, ptr @var3228; CHECK: sub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, lsl #529 30; Subtraction is not commutative!31  %rhs4 = load volatile i32, ptr @var3232  %shift4 = shl i32 %rhs4, 1933  %val4 = sub i32 %shift4, %lhs3234  store volatile i32 %val4, ptr @var3235; CHECK-NOT: sub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, lsl #1936 37  %lhs4a = load volatile i32, ptr @var3238  %shift4a = shl i32 %lhs4a, 1539  %val4a = sub i32 0, %shift4a40  store volatile i32 %val4a, ptr @var3241; CHECK: neg {{w[0-9]+}}, {{w[0-9]+}}, lsl #1542 43  %rhs5 = load volatile i64, ptr @var6444  %shift5 = shl i64 %rhs5, 1845  %val5 = add i64 %lhs64, %shift546  store volatile i64 %val5, ptr @var6447; CHECK: add {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, lsl #1848 49  %rhs6 = load volatile i64, ptr @var6450  %shift6 = shl i64 %rhs6, 3151  %val6 = add i64 %shift6, %lhs6452  store volatile i64 %val6, ptr @var6453; CHECK: add {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, lsl #3154 55  %rhs7 = load volatile i64, ptr @var6456  %shift7 = shl i64 %rhs7, 557  %val7 = sub i64 %lhs64, %shift758  store volatile i64 %val7, ptr @var6459; CHECK: sub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, lsl #560 61; Subtraction is not commutative!62  %rhs8 = load volatile i64, ptr @var6463  %shift8 = shl i64 %rhs8, 1964  %val8 = sub i64 %shift8, %lhs6465  store volatile i64 %val8, ptr @var6466; CHECK-NOT: sub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, lsl #1967 68  %lhs8a = load volatile i64, ptr @var6469  %shift8a = shl i64 %lhs8a, 6070  %val8a = sub i64 0, %shift8a71  store volatile i64 %val8a, ptr @var6472; CHECK: neg {{x[0-9]+}}, {{x[0-9]+}}, lsl #6073 74  ret void75; CHECK: ret76}77 78define void @test_lsr_arith(i32 %lhs32, i32 %rhs32, i64 %lhs64, i64 %rhs64) {79; CHECK-LABEL: test_lsr_arith:80 81  %shift1 = lshr i32 %rhs32, 1882  %val1 = add i32 %lhs32, %shift183  store volatile i32 %val1, ptr @var3284; CHECK: add {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, lsr #1885 86  %shift2 = lshr i32 %rhs32, 3187  %val2 = add i32 %shift2, %lhs3288  store volatile i32 %val2, ptr @var3289; CHECK: add {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, lsr #3190 91  %shift3 = lshr i32 %rhs32, 592  %val3 = sub i32 %lhs32, %shift393  store volatile i32 %val3, ptr @var3294; CHECK: sub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, lsr #595 96; Subtraction is not commutative!97  %shift4 = lshr i32 %rhs32, 1998  %val4 = sub i32 %shift4, %lhs3299  store volatile i32 %val4, ptr @var32100; CHECK-NOT: sub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, lsr #19101 102  %shift4a = lshr i32 %lhs32, 15103  %val4a = sub i32 0, %shift4a104  store volatile i32 %val4a, ptr @var32105; CHECK: neg {{w[0-9]+}}, {{w[0-9]+}}, lsr #15106 107  %shift5 = lshr i64 %rhs64, 18108  %val5 = add i64 %lhs64, %shift5109  store volatile i64 %val5, ptr @var64110; CHECK: add {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, lsr #18111 112  %shift6 = lshr i64 %rhs64, 31113  %val6 = add i64 %shift6, %lhs64114  store volatile i64 %val6, ptr @var64115; CHECK: add {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, lsr #31116 117  %shift7 = lshr i64 %rhs64, 5118  %val7 = sub i64 %lhs64, %shift7119  store volatile i64 %val7, ptr @var64120; CHECK: sub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, lsr #5121 122; Subtraction is not commutative!123  %shift8 = lshr i64 %rhs64, 19124  %val8 = sub i64 %shift8, %lhs64125  store volatile i64 %val8, ptr @var64126; CHECK-NOT: sub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, lsr #19127 128  %shift8a = lshr i64 %lhs64, 45129  %val8a = sub i64 0, %shift8a130  store volatile i64 %val8a, ptr @var64131; CHECK: neg {{x[0-9]+}}, {{x[0-9]+}}, lsr #45132 133  ret void134; CHECK: ret135}136 137define void @test_asr_arith(i32 %lhs32, i32 %rhs32, i64 %lhs64, i64 %rhs64) {138; CHECK-LABEL: test_asr_arith:139 140  %shift1 = ashr i32 %rhs32, 18141  %val1 = add i32 %lhs32, %shift1142  store volatile i32 %val1, ptr @var32143; CHECK: add {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, asr #18144 145  %shift2 = ashr i32 %rhs32, 31146  %val2 = add i32 %shift2, %lhs32147  store volatile i32 %val2, ptr @var32148; CHECK: add {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, asr #31149 150  %shift3 = ashr i32 %rhs32, 5151  %val3 = sub i32 %lhs32, %shift3152  store volatile i32 %val3, ptr @var32153; CHECK: sub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, asr #5154 155; Subtraction is not commutative!156  %shift4 = ashr i32 %rhs32, 19157  %val4 = sub i32 %shift4, %lhs32158  store volatile i32 %val4, ptr @var32159; CHECK-NOT: sub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, asr #19160 161  %shift4a = ashr i32 %lhs32, 15162  %val4a = sub i32 0, %shift4a163  store volatile i32 %val4a, ptr @var32164; CHECK: neg {{w[0-9]+}}, {{w[0-9]+}}, asr #15165 166  %shift5 = ashr i64 %rhs64, 18167  %val5 = add i64 %lhs64, %shift5168  store volatile i64 %val5, ptr @var64169; CHECK: add {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, asr #18170 171  %shift6 = ashr i64 %rhs64, 31172  %val6 = add i64 %shift6, %lhs64173  store volatile i64 %val6, ptr @var64174; CHECK: add {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, asr #31175 176  %shift7 = ashr i64 %rhs64, 5177  %val7 = sub i64 %lhs64, %shift7178  store volatile i64 %val7, ptr @var64179; CHECK: sub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, asr #5180 181; Subtraction is not commutative!182  %shift8 = ashr i64 %rhs64, 19183  %val8 = sub i64 %shift8, %lhs64184  store volatile i64 %val8, ptr @var64185; CHECK-NOT: sub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, asr #19186 187  %shift8a = ashr i64 %lhs64, 45188  %val8a = sub i64 0, %shift8a189  store volatile i64 %val8a, ptr @var64190; CHECK: neg {{x[0-9]+}}, {{x[0-9]+}}, asr #45191 192  ret void193; CHECK: ret194}195 196define void @test_cmp(i32 %lhs32, i32 %rhs32, i64 %lhs64, i64 %rhs64, i32 %v) {197; CHECK-LABEL: test_cmp:198 199  %shift1 = shl i32 %rhs32, 13200  %tst1 = icmp uge i32 %lhs32, %shift1201  br i1 %tst1, label %t2, label %end202; CHECK: cmp {{w[0-9]+}}, {{w[0-9]+}}, lsl #13203 204t2:205  store volatile i32 %v, ptr @var32206  %shift2 = lshr i32 %rhs32, 20207  %tst2 = icmp ne i32 %lhs32, %shift2208  br i1 %tst2, label %t3, label %end209; CHECK: cmp {{w[0-9]+}}, {{w[0-9]+}}, lsr #20210 211t3:212  store volatile i32 %v, ptr @var32213  %shift3 = ashr i32 %rhs32, 9214  %tst3 = icmp ne i32 %lhs32, %shift3215  br i1 %tst3, label %t4, label %end216; CHECK: cmp {{w[0-9]+}}, {{w[0-9]+}}, asr #9217 218t4:219  store volatile i32 %v, ptr @var32220  %shift4 = shl i64 %rhs64, 43221  %tst4 = icmp uge i64 %lhs64, %shift4222  br i1 %tst4, label %t5, label %end223; CHECK: cmp {{x[0-9]+}}, {{x[0-9]+}}, lsl #43224 225t5:226  store volatile i32 %v, ptr @var32227  %shift5 = lshr i64 %rhs64, 20228  %tst5 = icmp ne i64 %lhs64, %shift5229  br i1 %tst5, label %t6, label %end230; CHECK: cmp {{x[0-9]+}}, {{x[0-9]+}}, lsr #20231 232t6:233  store volatile i32 %v, ptr @var32234  %shift6 = ashr i64 %rhs64, 59235  %tst6 = icmp ne i64 %lhs64, %shift6236  br i1 %tst6, label %t7, label %end237; CHECK: cmp {{x[0-9]+}}, {{x[0-9]+}}, asr #59238 239t7:240  store volatile i32 %v, ptr @var32241  br label %end242 243end:244  ret void245; CHECK: ret246}247 248define i32 @test_cmn(i32 %lhs32, i32 %rhs32, i64 %lhs64, i64 %rhs64) {249; CHECK-LABEL: test_cmn:250 251  %shift1 = shl i32 %rhs32, 13252  %val1 = sub i32 0, %shift1253  %tst1 = icmp uge i32 %lhs32, %val1254  br i1 %tst1, label %t2, label %end255  ; Important that this isn't lowered to a cmn instruction because if %rhs32 ==256  ; 0 then the results will differ.257; CHECK: neg [[RHS:w[0-9]+]], {{w[0-9]+}}, lsl #13258; CHECK: cmp {{w[0-9]+}}, [[RHS]]259 260t2:261  %shift2 = lshr i32 %rhs32, 20262  %val2 = sub i32 0, %shift2263  %tst2 = icmp ne i32 %lhs32, %val2264  br i1 %tst2, label %t3, label %end265; CHECK: cmn {{w[0-9]+}}, {{w[0-9]+}}, lsr #20266 267t3:268  %shift3 = ashr i32 %rhs32, 9269  %val3 = sub i32 0, %shift3270  %tst3 = icmp eq i32 %lhs32, %val3271  br i1 %tst3, label %t4, label %end272; CHECK: cmn {{w[0-9]+}}, {{w[0-9]+}}, asr #9273 274t4:275  %shift4 = shl i64 %rhs64, 43276  %val4 = sub i64 0, %shift4277  %tst4 = icmp slt i64 %lhs64, %val4278  br i1 %tst4, label %t5, label %end279  ; Again, it's important that cmn isn't used here in case %rhs64 == 0.280; CHECK: neg [[RHS:x[0-9]+]], {{x[0-9]+}}, lsl #43281; CHECK: cmp {{x[0-9]+}}, [[RHS]]282 283t5:284  %shift5 = lshr i64 %rhs64, 20285  %val5 = sub i64 0, %shift5286  %tst5 = icmp ne i64 %lhs64, %val5287  br i1 %tst5, label %t6, label %end288; CHECK: cmn {{x[0-9]+}}, {{x[0-9]+}}, lsr #20289 290t6:291  %shift6 = ashr i64 %rhs64, 59292  %val6 = sub i64 0, %shift6293  %tst6 = icmp ne i64 %lhs64, %val6294  br i1 %tst6, label %t7, label %end295; CHECK: cmn {{x[0-9]+}}, {{x[0-9]+}}, asr #59296 297t7:298  ret i32 1299end:300 301  ret i32 0302; CHECK: ret303}304