|
| 1 | +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 |
| 2 | +# RUN: llc -o - -mtriple aarch64-- -run-pass=aarch64-prelegalizer-combiner %s | FileCheck %s |
| 3 | +--- |
| 4 | +name: test_combine_neg_and_one_to_sext_inreg_s32 |
| 5 | +body: | |
| 6 | + bb.1: |
| 7 | + liveins: $w0 |
| 8 | + ; CHECK-LABEL: name: test_combine_neg_and_one_to_sext_inreg_s32 |
| 9 | + ; CHECK: liveins: $w0 |
| 10 | + ; CHECK-NEXT: {{ $}} |
| 11 | + ; CHECK-NEXT: %x:_(s32) = COPY $w0 |
| 12 | + ; CHECK-NEXT: %res:_(s32) = G_SEXT_INREG %x, 1 |
| 13 | + ; CHECK-NEXT: $w0 = COPY %res(s32) |
| 14 | + %x:_(s32) = COPY $w0 |
| 15 | + %one:_(s32) = G_CONSTANT i32 1 |
| 16 | + %zero:_(s32) = G_CONSTANT i32 0 |
| 17 | + %and:_(s32) = G_AND %x:_, %one:_ |
| 18 | + %res:_(s32) = G_SUB %zero:_, %and:_ |
| 19 | + $w0 = COPY %res:_(s32) |
| 20 | +... |
| 21 | +--- |
| 22 | +name: test_combine_neg_and_one_to_sext_inreg_s64 |
| 23 | +body: | |
| 24 | + bb.1: |
| 25 | + liveins: $x0 |
| 26 | + ; CHECK-LABEL: name: test_combine_neg_and_one_to_sext_inreg_s64 |
| 27 | + ; CHECK: liveins: $x0 |
| 28 | + ; CHECK-NEXT: {{ $}} |
| 29 | + ; CHECK-NEXT: %x:_(s64) = COPY $x0 |
| 30 | + ; CHECK-NEXT: %res:_(s64) = G_SEXT_INREG %x, 1 |
| 31 | + ; CHECK-NEXT: $x0 = COPY %res(s64) |
| 32 | + %x:_(s64) = COPY $x0 |
| 33 | + %one:_(s64) = G_CONSTANT i64 1 |
| 34 | + %zero:_(s64) = G_CONSTANT i64 0 |
| 35 | + %and:_(s64) = G_AND %x:_, %one:_ |
| 36 | + %res:_(s64) = G_SUB %zero:_, %and:_ |
| 37 | + $x0 = COPY %res:_(s64) |
| 38 | +... |
| 39 | +--- |
| 40 | +name: test_combine_neg_and_one_to_sext_inreg_multiuse_should_not_transform |
| 41 | +body: | |
| 42 | + bb.1: |
| 43 | + liveins: $x0 |
| 44 | + ; CHECK-LABEL: name: test_combine_neg_and_one_to_sext_inreg_multiuse_should_not_transform |
| 45 | + ; CHECK: liveins: $x0 |
| 46 | + ; CHECK-NEXT: {{ $}} |
| 47 | + ; CHECK-NEXT: %x:_(s64) = COPY $x0 |
| 48 | + ; CHECK-NEXT: %one:_(s64) = G_CONSTANT i64 1 |
| 49 | + ; CHECK-NEXT: %zero:_(s64) = G_CONSTANT i64 0 |
| 50 | + ; CHECK-NEXT: %and:_(s64) = G_AND %x, %one |
| 51 | + ; CHECK-NEXT: %res:_(s64) = G_SUB %zero, %and |
| 52 | + ; CHECK-NEXT: $x0 = COPY %res(s64) |
| 53 | + ; CHECK-NEXT: $x1 = COPY %and(s64) |
| 54 | + %x:_(s64) = COPY $x0 |
| 55 | + %one:_(s64) = G_CONSTANT i64 1 |
| 56 | + %zero:_(s64) = G_CONSTANT i64 0 |
| 57 | + %and:_(s64) = G_AND %x:_, %one:_ |
| 58 | + %res:_(s64) = G_SUB %zero:_, %and:_ |
| 59 | + $x0 = COPY %res:_(s64) |
| 60 | + $x1 = COPY %and:_(s64) |
| 61 | +... |
| 62 | +--- |
| 63 | +name: test_combine_neg_and_one_to_sext_inreg_v2i32 |
| 64 | +body: | |
| 65 | + bb.1: |
| 66 | + liveins: $d0 |
| 67 | + ; CHECK-LABEL: name: test_combine_neg_and_one_to_sext_inreg_v2i32 |
| 68 | + ; CHECK: liveins: $d0 |
| 69 | + ; CHECK-NEXT: {{ $}} |
| 70 | + ; CHECK-NEXT: %x:_(<2 x s32>) = COPY $d0 |
| 71 | + ; CHECK-NEXT: %res:_(<2 x s32>) = G_SEXT_INREG %x, 1 |
| 72 | + ; CHECK-NEXT: $d0 = COPY %res(<2 x s32>) |
| 73 | + %x:_(<2 x s32>) = COPY $d0 |
| 74 | + %one:_(s32) = G_CONSTANT i32 1 |
| 75 | + %ones:_(<2 x s32>) = G_BUILD_VECTOR %one, %one |
| 76 | + %zero:_(s32) = G_CONSTANT i32 0 |
| 77 | + %zeros:_(<2 x s32>) = G_BUILD_VECTOR %zero, %zero |
| 78 | + %and:_(<2 x s32>) = G_AND %x:_, %ones:_ |
| 79 | + %res:_(<2 x s32>) = G_SUB %zeros:_, %and:_ |
| 80 | + $d0 = COPY %res:_(<2 x s32>) |
| 81 | +... |
0 commit comments