|
| 1 | +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py |
| 2 | +# RUN: llc -o - -mtriple=aarch64-unknown-unknown -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s | FileCheck %s --check-prefixes=CHECK,CHECK-PRE |
| 3 | +# RUN: llc -o - -mtriple=aarch64-unknown-unknown -run-pass=aarch64-postlegalizer-combiner -verify-machineinstrs %s | FileCheck %s --check-prefixes=CHECK,CHECK-POST |
| 4 | + |
| 5 | +--- |
| 6 | +name: test_combine_trunc_select |
| 7 | +legalized: true |
| 8 | +body: | |
| 9 | + bb.1: |
| 10 | + ; CHECK-PRE-LABEL: name: test_combine_trunc_select |
| 11 | + ; CHECK-PRE: %cond:_(s32) = COPY $w0 |
| 12 | + ; CHECK-PRE-NEXT: %lhs:_(s64) = COPY $x0 |
| 13 | + ; CHECK-PRE-NEXT: %rhs:_(s64) = COPY $x0 |
| 14 | + ; CHECK-PRE-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC %lhs(s64) |
| 15 | + ; CHECK-PRE-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC %rhs(s64) |
| 16 | + ; CHECK-PRE-NEXT: %small:_(s32) = G_SELECT %cond(s32), [[TRUNC]], [[TRUNC1]] |
| 17 | + ; CHECK-PRE-NEXT: $w0 = COPY %small(s32) |
| 18 | + ; |
| 19 | + ; CHECK-POST-LABEL: name: test_combine_trunc_select |
| 20 | + ; CHECK-POST: %cond:_(s32) = COPY $w0 |
| 21 | + ; CHECK-POST-NEXT: %lhs:_(s64) = COPY $x0 |
| 22 | + ; CHECK-POST-NEXT: %rhs:_(s64) = COPY $x0 |
| 23 | + ; CHECK-POST-NEXT: %res:_(s64) = G_SELECT %cond(s32), %lhs, %rhs |
| 24 | + ; CHECK-POST-NEXT: %small:_(s32) = G_TRUNC %res(s64) |
| 25 | + ; CHECK-POST-NEXT: $w0 = COPY %small(s32) |
| 26 | + %cond:_(s32) = COPY $w0 |
| 27 | + %lhs:_(s64) = COPY $x0 |
| 28 | + %rhs:_(s64) = COPY $x0 |
| 29 | + %res:_(s64) = G_SELECT %cond(s32), %lhs, %rhs |
| 30 | + %small:_(s32) = G_TRUNC %res(s64) |
| 31 | + $w0 = COPY %small(s32) |
| 32 | +... |
| 33 | +--- |
| 34 | +name: test_combine_zext_select |
| 35 | +legalized: true |
| 36 | +body: | |
| 37 | + bb.1: |
| 38 | + ; CHECK-PRE-LABEL: name: test_combine_zext_select |
| 39 | + ; CHECK-PRE: %cond:_(s32) = COPY $w0 |
| 40 | + ; CHECK-PRE-NEXT: %lhs:_(s32) = COPY $w0 |
| 41 | + ; CHECK-PRE-NEXT: %rhs:_(s32) = COPY $w0 |
| 42 | + ; CHECK-PRE-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT %lhs(s32) |
| 43 | + ; CHECK-PRE-NEXT: [[ZEXT1:%[0-9]+]]:_(s64) = G_ZEXT %rhs(s32) |
| 44 | + ; CHECK-PRE-NEXT: %big:_(s64) = G_SELECT %cond(s32), [[ZEXT]], [[ZEXT1]] |
| 45 | + ; CHECK-PRE-NEXT: $x0 = COPY %big(s64) |
| 46 | + ; |
| 47 | + ; CHECK-POST-LABEL: name: test_combine_zext_select |
| 48 | + ; CHECK-POST: %cond:_(s32) = COPY $w0 |
| 49 | + ; CHECK-POST-NEXT: %lhs:_(s32) = COPY $w0 |
| 50 | + ; CHECK-POST-NEXT: %rhs:_(s32) = COPY $w0 |
| 51 | + ; CHECK-POST-NEXT: %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs |
| 52 | + ; CHECK-POST-NEXT: %big:_(s64) = G_ZEXT %res(s32) |
| 53 | + ; CHECK-POST-NEXT: $x0 = COPY %big(s64) |
| 54 | + %cond:_(s32) = COPY $w0 |
| 55 | + %lhs:_(s32) = COPY $w0 |
| 56 | + %rhs:_(s32) = COPY $w0 |
| 57 | + %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs |
| 58 | + %big:_(s64) = G_ZEXT %res(s32) |
| 59 | + $x0 = COPY %big(s64) |
| 60 | +... |
| 61 | +--- |
| 62 | +name: test_combine_anyzext_select |
| 63 | +legalized: true |
| 64 | +body: | |
| 65 | + bb.1: |
| 66 | + ; CHECK-PRE-LABEL: name: test_combine_anyzext_select |
| 67 | + ; CHECK-PRE: %cond:_(s32) = COPY $w0 |
| 68 | + ; CHECK-PRE-NEXT: %lhs:_(s32) = COPY $w0 |
| 69 | + ; CHECK-PRE-NEXT: %rhs:_(s32) = COPY $w0 |
| 70 | + ; CHECK-PRE-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT %lhs(s32) |
| 71 | + ; CHECK-PRE-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT %rhs(s32) |
| 72 | + ; CHECK-PRE-NEXT: %big:_(s64) = G_SELECT %cond(s32), [[ANYEXT]], [[ANYEXT1]] |
| 73 | + ; CHECK-PRE-NEXT: $x0 = COPY %big(s64) |
| 74 | + ; |
| 75 | + ; CHECK-POST-LABEL: name: test_combine_anyzext_select |
| 76 | + ; CHECK-POST: %cond:_(s32) = COPY $w0 |
| 77 | + ; CHECK-POST-NEXT: %lhs:_(s32) = COPY $w0 |
| 78 | + ; CHECK-POST-NEXT: %rhs:_(s32) = COPY $w0 |
| 79 | + ; CHECK-POST-NEXT: %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs |
| 80 | + ; CHECK-POST-NEXT: %big:_(s64) = G_ANYEXT %res(s32) |
| 81 | + ; CHECK-POST-NEXT: $x0 = COPY %big(s64) |
| 82 | + %cond:_(s32) = COPY $w0 |
| 83 | + %lhs:_(s32) = COPY $w0 |
| 84 | + %rhs:_(s32) = COPY $w0 |
| 85 | + %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs |
| 86 | + %big:_(s64) = G_ANYEXT %res(s32) |
| 87 | + $x0 = COPY %big(s64) |
| 88 | +... |
| 89 | +--- |
| 90 | +name: test_combine_anyzext_select_multi_use |
| 91 | +legalized: true |
| 92 | +body: | |
| 93 | + bb.1: |
| 94 | + ; CHECK-LABEL: name: test_combine_anyzext_select_multi_use |
| 95 | + ; CHECK: %cond:_(s32) = COPY $w0 |
| 96 | + ; CHECK-NEXT: %lhs:_(s32) = COPY $w0 |
| 97 | + ; CHECK-NEXT: %rhs:_(s32) = COPY $w0 |
| 98 | + ; CHECK-NEXT: %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs |
| 99 | + ; CHECK-NEXT: %big:_(s64) = G_ANYEXT %res(s32) |
| 100 | + ; CHECK-NEXT: $x0 = COPY %big(s64) |
| 101 | + ; CHECK-NEXT: $w0 = COPY %res(s32) |
| 102 | + %cond:_(s32) = COPY $w0 |
| 103 | + %lhs:_(s32) = COPY $w0 |
| 104 | + %rhs:_(s32) = COPY $w0 |
| 105 | + %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs |
| 106 | + %big:_(s64) = G_ANYEXT %res(s32) |
| 107 | + $x0 = COPY %big(s64) |
| 108 | + $w0 = COPY %res(s32) |
| 109 | +... |
| 110 | +--- |
| 111 | +name: test_combine_trunc_select_vector_out_of_budget |
| 112 | +legalized: true |
| 113 | +body: | |
| 114 | + bb.1: |
| 115 | + ; CHECK-LABEL: name: test_combine_trunc_select_vector_out_of_budget |
| 116 | + ; CHECK: %cond:_(<2 x s32>) = COPY $x0 |
| 117 | + ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 |
| 118 | + ; CHECK-NEXT: %arg2:_(s64) = COPY $x0 |
| 119 | + ; CHECK-NEXT: %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) |
| 120 | + ; CHECK-NEXT: %bv2:_(<2 x s64>) = G_BUILD_VECTOR %arg2(s64), %arg1(s64) |
| 121 | + ; CHECK-NEXT: %res:_(<2 x s64>) = G_SELECT %cond(<2 x s32>), %bv, %bv2 |
| 122 | + ; CHECK-NEXT: %small:_(<2 x s32>) = G_TRUNC %res(<2 x s64>) |
| 123 | + ; CHECK-NEXT: $x0 = COPY %small(<2 x s32>) |
| 124 | + %cond:_(<2 x s32>) = COPY $x0 |
| 125 | + %arg1:_(s64) = COPY $x0 |
| 126 | + %arg2:_(s64) = COPY $x0 |
| 127 | + %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) |
| 128 | + %bv2:_(<2 x s64>) = G_BUILD_VECTOR %arg2(s64), %arg1(s64) |
| 129 | + %res:_(<2 x s64>) = G_SELECT %cond(<2 x s32>), %bv, %bv2 |
| 130 | + %small:_(<2 x s32>) = G_TRUNC %res(<2 x s64>) |
| 131 | + $x0 = COPY %small(<2 x s32>) |
0 commit comments