brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 9caf348 Raw
124 lines · plain
1; RUN: llc -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s2 3; CHECK-LABEL: @test14; CHECK: sbfx {{x[0-9]+}}, x0, #23, #95define i64 @test1(i32 %a) {6  %tmp = ashr i32 %a, 237  %ext = sext i32 %tmp to i648  %res = add i64 %ext, 19  ret i64 %res10}11 12; CHECK-LABEL: @test213; CHECK: sbfx w0, w0, #23, #814define signext i8 @test2(i32 %a) {15  %tmp = ashr i32 %a, 2316  %res = trunc i32 %tmp to i817  ret i8 %res18}19 20; CHECK-LABEL: @test321; CHECK: sbfx w0, w0, #23, #822define signext i8 @test3(i32 %a) {23  %tmp = lshr i32 %a, 2324  %res = trunc i32 %tmp to i825  ret i8 %res26}27 28; CHECK-LABEL: @test429; CHECK: sbfx w0, w0, #15, #1630define signext i16 @test4(i32 %a) {31  %tmp = lshr i32 %a, 1532  %res = trunc i32 %tmp to i1633  ret i16 %res34}35 36; CHECK-LABEL: @test537; CHECK: sbfx w0, w0, #16, #838define signext i8 @test5(i64 %a) {39  %tmp = lshr i64 %a, 1640  %res = trunc i64 %tmp to i841  ret i8 %res42}43 44; CHECK-LABEL: @test645; CHECK: sbfx x0, x0, #30, #846define signext i8 @test6(i64 %a) {47  %tmp = lshr i64 %a, 3048  %res = trunc i64 %tmp to i849  ret i8 %res50}51 52; CHECK-LABEL: @test753; CHECK: sbfx x0, x0, #23, #1654define signext i16 @test7(i64 %a) {55  %tmp = lshr i64 %a, 2356  %res = trunc i64 %tmp to i1657  ret i16 %res58}59 60; CHECK-LABEL: @test861; CHECK: asr w0, w0, #2562define signext i8 @test8(i32 %a) {63  %tmp = ashr i32 %a, 2564  %res = trunc i32 %tmp to i865  ret i8 %res66}67 68; CHECK-LABEL: @test969; CHECK: lsr w0, w0, #2570define signext i8 @test9(i32 %a) {71  %tmp = lshr i32 %a, 2572  %res = trunc i32 %tmp to i873  ret i8 %res74}75 76; CHECK-LABEL: @test1077; CHECK: lsr x0, x0, #4978define signext i16 @test10(i64 %a) {79  %tmp = lshr i64 %a, 4980  %res = trunc i64 %tmp to i1681  ret i16 %res82}83 84; SHR with multiple uses is fine as SXTH and SBFX are both aliases of SBFM.85; However, allowing the transformation means the SHR and SBFX can execute in86; parallel.87;88; CHECK-LABEL: @test1189; CHECK: lsr x1, x0, #2390; CHECK: sbfx x0, x0, #23, #1691define void @test11(i64 %a) {92  %tmp = lshr i64 %a, 2393  %res = trunc i64 %tmp to i1694  call void @use(i16 signext %res, i64 %tmp)95  ret void96}97 98declare void @use(i16 signext, i64)99 100; CHECK-LABEL: test_complex_node:101; CHECK: ldr d0, [x0], #8102; CHECK: lsr w[[VAL:[0-9]+]], w0, #5103; CHECK: str w[[VAL]], [x2]104define <2 x i32> @test_complex_node(ptr %addr, ptr %addr2, ptr %bf ) {105  %vec = load <2 x i32>, ptr %addr106 107  %vec.next = getelementptr <2 x i32>, ptr %addr, i32 1108  store ptr %vec.next, ptr %addr2109  %lo = ptrtoint ptr %vec.next to i32110 111  %val = lshr i32 %lo, 5112  store i32 %val, ptr %bf113 114  ret <2 x i32> %vec115}116 117; CHECK-LABEL: @test12118; CHECK: lsr w0, w0, #10119define i32 @test12(i64 %a) {120  %tmp = trunc i64 %a to i32121  %res = lshr i32 %tmp, 10122  ret i32 %res123}124