| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py |
| # RUN: llc -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s |
| # RUN: llc -debugify-and-strip-all-safe -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown-unknown %s -o - | FileCheck %s |
| # REQUIRES: asserts |
| |
| --- |
| # select (c, x, x) -> x |
| name: test_combine_select_same_res |
| body: | |
| bb.1: |
| liveins: $x0, $x1 |
| ; CHECK-LABEL: name: test_combine_select_same_res |
| ; CHECK: liveins: $x0, $x1 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: $x0 = COPY [[COPY]](s64) |
| %0:_(s64) = COPY $x0 |
| %1:_(s1) = G_TRUNC %0 |
| %2:_(s64) = G_SELECT %1, %0, %0 |
| $x0 = COPY %2(s64) |
| ... |
| --- |
| # select (undef, x, y) -> y |
| name: test_combine_select_undef_res0_res1 |
| body: | |
| bb.1: |
| liveins: $x0, $x1 |
| ; CHECK-LABEL: name: test_combine_select_undef_res0_res1 |
| ; CHECK: liveins: $x0, $x1 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: $x0 = COPY [[COPY]](s64) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s1) = G_IMPLICIT_DEF |
| %3:_(s64) = G_SELECT %2, %0, %1 |
| $x0 = COPY %3(s64) |
| ... |
| --- |
| # select (false, x, y) -> y |
| name: test_combine_select_false_res0_res1 |
| body: | |
| bb.1: |
| liveins: $x0, $x1 |
| ; CHECK-LABEL: name: test_combine_select_false_res0_res1 |
| ; CHECK: liveins: $x0, $x1 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: $x0 = COPY [[COPY]](s64) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s1) = G_CONSTANT i1 false |
| %3:_(s64) = G_SELECT %2, %0, %1 |
| $x0 = COPY %3(s64) |
| ... |
| --- |
| # vector select (false, x, y) -> y |
| name: test_combine_vector_select_false_res0_res1 |
| body: | |
| bb.1: |
| liveins: $q0, $q1 |
| ; CHECK-LABEL: name: test_combine_vector_select_false_res0_res1 |
| ; CHECK: liveins: $q0, $q1 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q1 |
| ; CHECK-NEXT: $q0 = COPY [[COPY]](<4 x s32>) |
| %0:_(<4 x s32>) = COPY $q0 |
| %1:_(<4 x s32>) = COPY $q1 |
| %2:_(s1) = G_CONSTANT i1 false |
| %condvec:_(<4 x s1>) = G_BUILD_VECTOR %2, %2, %2, %2 |
| %3:_(<4 x s32>) = G_SELECT %condvec, %0, %1 |
| $q0 = COPY %3(<4 x s32>) |
| ... |
| --- |
| # select (true, x, y) -> x |
| name: test_combine_select_true_res0_res1 |
| body: | |
| bb.1: |
| liveins: $x0, $x1 |
| ; CHECK-LABEL: name: test_combine_select_true_res0_res1 |
| ; CHECK: liveins: $x0, $x1 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: $x0 = COPY [[COPY]](s64) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s1) = G_CONSTANT i1 true |
| %3:_(s64) = G_SELECT %2, %0, %1 |
| $x0 = COPY %3(s64) |
| ... |
| --- |
| # vector select (true, x, y) -> x |
| name: test_combine_vector_select_true_res0_res1 |
| body: | |
| bb.1: |
| liveins: $q0, $q1 |
| ; CHECK-LABEL: name: test_combine_vector_select_true_res0_res1 |
| ; CHECK: liveins: $q0, $q1 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0 |
| ; CHECK-NEXT: $q0 = COPY [[COPY]](<4 x s32>) |
| %0:_(<4 x s32>) = COPY $q0 |
| %1:_(<4 x s32>) = COPY $q1 |
| %2:_(s1) = G_CONSTANT i1 true |
| %condvec:_(<4 x s1>) = G_BUILD_VECTOR %2, %2, %2, %2 |
| %3:_(<4 x s32>) = G_SELECT %condvec, %0, %1 |
| $q0 = COPY %3(<4 x s32>) |
| ... |
| --- |
| # select Cond, Cond, F --> or Cond, F |
| name: bool_cond_cond_false |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: bool_cond_cond_false |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x2 |
| ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]] |
| ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[COPY]], [[FREEZE]] |
| ; CHECK-NEXT: %sel:_(s1) = G_TRUNC [[OR]](s64) |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %sel:_(s1) = G_SELECT %c, %c, %f |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select Cond, 1, F --> or Cond, F |
| name: bool_cond_one_false |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: bool_cond_one_false |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x2 |
| ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]] |
| ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[COPY]], [[FREEZE]] |
| ; CHECK-NEXT: %sel:_(s1) = G_TRUNC [[OR]](s64) |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %one:_(s1) = G_CONSTANT i1 1 |
| %sel:_(s1) = G_SELECT %c, %one, %f |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select Cond, 1, F --> or Cond, F |
| name: bool_cond_one_false_vector |
| body: | |
| bb.1: |
| liveins: $d0, $d1, $d2 |
| ; CHECK-LABEL: name: bool_cond_one_false_vector |
| ; CHECK: liveins: $d0, $d1, $d2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d2 |
| ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(<2 x s32>) = G_FREEZE [[COPY1]] |
| ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<2 x s32>) = G_OR [[COPY]], [[FREEZE]] |
| ; CHECK-NEXT: $d0 = COPY [[OR]](<2 x s32>) |
| %0:_(<2 x s32>) = COPY $d0 |
| %1:_(<2 x s32>) = COPY $d1 |
| %2:_(<2 x s32>) = COPY $d2 |
| %c:_(<2 x s1>) = G_TRUNC %0 |
| %t:_(<2 x s1>) = G_TRUNC %1 |
| %f:_(<2 x s1>) = G_TRUNC %2 |
| %one:_(s1) = G_CONSTANT i1 1 |
| %one_vec:_(<2 x s1>) = G_BUILD_VECTOR %one, %one |
| %sel:_(<2 x s1>) = G_SELECT %c, %one_vec, %f |
| %ext:_(<2 x s32>) = G_ANYEXT %sel |
| $d0 = COPY %ext(<2 x s32>) |
| ... |
| --- |
| # select Cond, T, Cond --> and Cond, T |
| name: bool_cond_true_cond |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: bool_cond_true_cond |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]] |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[FREEZE]] |
| ; CHECK-NEXT: %sel:_(s1) = G_TRUNC [[AND]](s64) |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %one:_(s1) = G_CONSTANT i1 1 |
| %sel:_(s1) = G_SELECT %c, %t, %c |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select Cond, T, 0 --> and Cond, T |
| name: bool_cond_true_zero |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: bool_cond_true_zero |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]] |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[FREEZE]] |
| ; CHECK-NEXT: %sel:_(s1) = G_TRUNC [[AND]](s64) |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %zero:_(s1) = G_CONSTANT i1 0 |
| %sel:_(s1) = G_SELECT %c, %t, %zero |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select Cond, T, 1 --> or (not Cond), T |
| name: bool_cond_true_one |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: bool_cond_true_one |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]] |
| ; CHECK-NEXT: %t:_(s1) = G_TRUNC [[FREEZE]](s64) |
| ; CHECK-NEXT: %one:_(s1) = G_CONSTANT i1 true |
| ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, %one |
| ; CHECK-NEXT: %sel:_(s1) = G_OR [[XOR]], %t |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %one:_(s1) = G_CONSTANT i1 1 |
| %sel:_(s1) = G_SELECT %c, %t, %one |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select Cond, 0, F --> and (not Cond), F |
| name: bool_cond_zero_false |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: bool_cond_zero_false |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x2 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:_(s64) = G_FREEZE [[COPY1]] |
| ; CHECK-NEXT: %f:_(s1) = G_TRUNC [[FREEZE]](s64) |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 true |
| ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, [[C]] |
| ; CHECK-NEXT: %sel:_(s1) = G_AND [[XOR]], %f |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s1) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %zero:_(s1) = G_CONSTANT i1 0 |
| %sel:_(s1) = G_SELECT %c, %zero, %f |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select cond, 1, 0 --> zext(Cond) |
| name: select_cond_1_0_to_zext_cond |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_cond_1_0_to_zext_cond |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %c(s1) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %zero:_(s1) = G_CONSTANT i1 0 |
| %one:_(s1) = G_CONSTANT i1 1 |
| %sel:_(s1) = G_SELECT %c, %one, %zero |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select cond, 0, 1 --> zext(!Cond) |
| name: select_cond_0_1_to_sext_not_cond |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_cond_0_1_to_sext_not_cond |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %one:_(s1) = G_CONSTANT i1 true |
| ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, %one |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT [[XOR]](s1) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %zero:_(s1) = G_CONSTANT i1 0 |
| %one:_(s1) = G_CONSTANT i1 1 |
| %sel:_(s1) = G_SELECT %c, %zero, %one |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select cond, 2, 1 --> and (zext Cond), false |
| name: select_cond_2_1_to_and_zext_cond_false |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_cond_2_1_to_and_zext_cond_false |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %one:_(s8) = G_CONSTANT i8 101 |
| ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s8) = G_ZEXT %c(s1) |
| ; CHECK-NEXT: %sel:_(s8) = G_ADD [[ZEXT]], %one |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %two:_(s8) = G_CONSTANT i8 102 |
| %one:_(s8) = G_CONSTANT i8 101 |
| %sel:_(s8) = G_SELECT %c, %two, %one |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select cond, 1, 2 --> and (ext Cond), false |
| name: select_cond_1_2_to_and_sext_cond_false |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_cond_1_2_to_and_sext_cond_false |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %one:_(s8) = G_CONSTANT i8 102 |
| ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s8) = G_SEXT %c(s1) |
| ; CHECK-NEXT: %sel:_(s8) = G_ADD [[SEXT]], %one |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %two:_(s8) = G_CONSTANT i8 101 |
| %one:_(s8) = G_CONSTANT i8 102 |
| %sel:_(s8) = G_SELECT %c, %two, %one |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select cond, 64, 0 --> (zext Cond) << log2(Pow2) |
| name: select_cond_64_0_to_shift |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_cond_64_0_to_shift |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s8) = G_ZEXT %c(s1) |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 6 |
| ; CHECK-NEXT: %sel:_(s8) = G_SHL [[ZEXT]], [[C]](s8) |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %two:_(s8) = G_CONSTANT i8 64 |
| %one:_(s8) = G_CONSTANT i8 0 |
| %sel:_(s8) = G_SELECT %c, %two, %one |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select cond, 0, 64 --> (zext (!Cond)) << log2(Pow2) |
| name: select_cond_0_64_to_shift |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_cond_0_64_to_shift |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 true |
| ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, [[C]] |
| ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s8) = G_ZEXT [[XOR]](s1) |
| ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s8) = G_CONSTANT i8 6 |
| ; CHECK-NEXT: %sel:_(s8) = G_SHL [[ZEXT]], [[C1]](s8) |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %two:_(s8) = G_CONSTANT i8 0 |
| %one:_(s8) = G_CONSTANT i8 64 |
| %sel:_(s8) = G_SELECT %c, %two, %one |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select cond, -1, 0 --> sext Cond |
| name: select_cond_minus_1_0_to_sext_cond |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_cond_minus_1_0_to_sext_cond |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %ext:_(s32) = G_SEXT %c(s1) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %two:_(s8) = G_CONSTANT i8 255 |
| %one:_(s8) = G_CONSTANT i8 0 |
| %sel:_(s8) = G_SELECT %c, %two, %one |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select cond, 0, -1 --> sext (!Cond) |
| name: select_cond_0_minus_1_to_sext_not_cond |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_cond_0_minus_1_to_sext_not_cond |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 true |
| ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, [[C]] |
| ; CHECK-NEXT: %ext:_(s32) = G_SEXT [[XOR]](s1) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %two:_(s8) = G_CONSTANT i8 0 |
| %one:_(s8) = G_CONSTANT i8 255 |
| %sel:_(s8) = G_SELECT %c, %two, %one |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select cond, -1, 101 --> or (sext Cond), 101 |
| name: select_cond_minus_1_101_to_or_sext_cond_101 |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_cond_minus_1_101_to_or_sext_cond_101 |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %one:_(s8) = G_CONSTANT i8 101 |
| ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s8) = G_SEXT %c(s1) |
| ; CHECK-NEXT: %sel:_(s8) = G_OR [[SEXT]], %one |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %two:_(s8) = G_CONSTANT i8 255 |
| %one:_(s8) = G_CONSTANT i8 101 |
| %sel:_(s8) = G_SELECT %c, %two, %one |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select cond, 101, -1 --> or (sext (not Cond), 101 |
| name: select_cond_101_minus_1_to_or_sext_not_cond_101 |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_cond_101_minus_1_to_or_sext_not_cond_101 |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %two:_(s8) = G_CONSTANT i8 101 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 true |
| ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s1) = G_XOR %c, [[C]] |
| ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s8) = G_SEXT [[XOR]](s1) |
| ; CHECK-NEXT: %sel:_(s8) = G_OR [[SEXT]], %two |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %c:_(s1) = G_TRUNC %0 |
| %t:_(s1) = G_TRUNC %1 |
| %f:_(s1) = G_TRUNC %2 |
| %two:_(s8) = G_CONSTANT i8 101 |
| %one:_(s8) = G_CONSTANT i8 255 |
| %sel:_(s8) = G_SELECT %c, %two, %one |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # select test(failed,registers) select icmp_ugt t,f_t_f --> umax(t,f) |
| name: select_failed_icmp_ugt_t_f_t_f_umax_t_f |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_failed_icmp_ugt_t_f_t_f_umax_t_f |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2 |
| ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x3 |
| ; CHECK-NEXT: %t:_(s8) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f:_(s8) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %y:_(s8) = G_TRUNC [[COPY2]](s64) |
| ; CHECK-NEXT: %z:_(s8) = G_TRUNC [[COPY3]](s64) |
| ; CHECK-NEXT: %c:_(s8) = G_ICMP intpred(ugt), %t(s8), %y |
| ; CHECK-NEXT: %sel:_(s8) = exact G_SELECT %c(s8), %f, %z |
| ; CHECK-NEXT: %ext:_(s32) = G_ANYEXT %sel(s8) |
| ; CHECK-NEXT: $w0 = COPY %ext(s32) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %2:_(s64) = COPY $x2 |
| %3:_(s64) = COPY $x3 |
| %4:_(s64) = COPY $x4 |
| %t:_(s8) = G_TRUNC %0 |
| %f:_(s8) = G_TRUNC %1 |
| %y:_(s8) = G_TRUNC %2 |
| %z:_(s8) = G_TRUNC %3 |
| %c:_(s8) = G_ICMP intpred(ugt), %t(s8), %y(s8) |
| %sel:_(s8) = exact G_SELECT %c, %f, %z |
| %ext:_(s32) = G_ANYEXT %sel |
| $w0 = COPY %ext(s32) |
| ... |
| --- |
| # test select icmp_ugt t,f_t_f --> umax(t,f) |
| name: select_icmp_ugt_t_f_t_f_umax_t_f |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_icmp_ugt_t_f_t_f_umax_t_f |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32) |
| ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32) |
| ; CHECK-NEXT: %sel:_(<4 x s32>) = G_UMAX %t, %f |
| ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %t1:_(s32) = G_TRUNC %0 |
| %f1:_(s32) = G_TRUNC %1 |
| %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1 |
| %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1 |
| %c:_(<4 x s32>) = G_ICMP intpred(ugt), %t(<4 x s32>), %f(<4 x s32>) |
| %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f |
| $q0 = COPY %sel(<4 x s32>) |
| ... |
| --- |
| # test select icmp_uge t,f_t_f --> umax(t,f) |
| name: select_icmp_uge_t_f_t_f_umax_t_f |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_icmp_uge_t_f_t_f_umax_t_f |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32) |
| ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32) |
| ; CHECK-NEXT: %sel:_(<4 x s32>) = G_UMAX %t, %f |
| ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %t1:_(s32) = G_TRUNC %0 |
| %f1:_(s32) = G_TRUNC %1 |
| %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1 |
| %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1 |
| %c:_(<4 x s32>) = G_ICMP intpred(uge), %t(<4 x s32>), %f(<4 x s32>) |
| %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f |
| $q0 = COPY %sel(<4 x s32>) |
| ... |
| --- |
| # test select icmp_sgt t,f_t_f --> smax(t,f) |
| name: select_icmp_sgt_t_f_t_f_smax_t_f |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_icmp_sgt_t_f_t_f_smax_t_f |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32) |
| ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32) |
| ; CHECK-NEXT: %sel:_(<4 x s32>) = G_SMAX %t, %f |
| ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %t1:_(s32) = G_TRUNC %0 |
| %f1:_(s32) = G_TRUNC %1 |
| %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1 |
| %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1 |
| %c:_(<4 x s32>) = G_ICMP intpred(sgt), %t(<4 x s32>), %f(<4 x s32>) |
| %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f |
| $q0 = COPY %sel(<4 x s32>) |
| ... |
| --- |
| # test select icmp_sge t,f_t_f --> smax(t,f) |
| name: select_icmp_sge_t_f_t_f_smax_t_f |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_icmp_sge_t_f_t_f_smax_t_f |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32) |
| ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32) |
| ; CHECK-NEXT: %sel:_(<4 x s32>) = G_SMAX %t, %f |
| ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %t1:_(s32) = G_TRUNC %0 |
| %f1:_(s32) = G_TRUNC %1 |
| %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1 |
| %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1 |
| %c:_(<4 x s32>) = G_ICMP intpred(sge), %t(<4 x s32>), %f(<4 x s32>) |
| %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f |
| $q0 = COPY %sel(<4 x s32>) |
| ... |
| --- |
| # test select icmp_ult t,f_t_f --> umin(t,f) |
| name: select_icmp_ult_t_f_t_f_umin_t_f |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_icmp_ult_t_f_t_f_umin_t_f |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32) |
| ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32) |
| ; CHECK-NEXT: %sel:_(<4 x s32>) = G_UMIN %t, %f |
| ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %t1:_(s32) = G_TRUNC %0 |
| %f1:_(s32) = G_TRUNC %1 |
| %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1 |
| %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1 |
| %c:_(<4 x s32>) = G_ICMP intpred(ult), %t(<4 x s32>), %f(<4 x s32>) |
| %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f |
| $q0 = COPY %sel(<4 x s32>) |
| ... |
| --- |
| # test select icmp_ule t,f_t_f --> umin(t,f) |
| name: select_icmp_ule_t_f_t_f_umin_t_f |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_icmp_ule_t_f_t_f_umin_t_f |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32) |
| ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32) |
| ; CHECK-NEXT: %sel:_(<4 x s32>) = G_UMIN %t, %f |
| ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %t1:_(s32) = G_TRUNC %0 |
| %f1:_(s32) = G_TRUNC %1 |
| %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1 |
| %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1 |
| %c:_(<4 x s32>) = G_ICMP intpred(ule), %t(<4 x s32>), %f(<4 x s32>) |
| %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f |
| $q0 = COPY %sel(<4 x s32>) |
| ... |
| --- |
| # test select icmp_slt t,f_t_f --> smin(t,f) |
| name: select_icmp_slt_t_f_t_f_smin_t_f |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_icmp_slt_t_f_t_f_smin_t_f |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32) |
| ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32) |
| ; CHECK-NEXT: %sel:_(<4 x s32>) = G_SMIN %t, %f |
| ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %t1:_(s32) = G_TRUNC %0 |
| %f1:_(s32) = G_TRUNC %1 |
| %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1 |
| %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1 |
| %c:_(<4 x s32>) = G_ICMP intpred(slt), %t(<4 x s32>), %f(<4 x s32>) |
| %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f |
| $q0 = COPY %sel(<4 x s32>) |
| ... |
| --- |
| # test select icmp_sle t,f_t_f --> smin(t,f) |
| name: select_icmp_sle_t_f_t_f_smin_t_f |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_icmp_sle_t_f_t_f_smin_t_f |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32) |
| ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32) |
| ; CHECK-NEXT: %sel:_(<4 x s32>) = G_SMIN %t, %f |
| ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %t1:_(s32) = G_TRUNC %0 |
| %f1:_(s32) = G_TRUNC %1 |
| %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1 |
| %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1 |
| %c:_(<4 x s32>) = G_ICMP intpred(sle), %t(<4 x s32>), %f(<4 x s32>) |
| %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f |
| $q0 = COPY %sel(<4 x s32>) |
| ... |
| --- |
| # multi use test select icmp_sle t,f_t_f --> smin(t,f) failed |
| name: multi_use_select_icmp_sle_t_f_t_f_smin_t_f_failed |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: multi_use_select_icmp_sle_t_f_t_f_smin_t_f_failed |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32) |
| ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32) |
| ; CHECK-NEXT: %c:_(<4 x s32>) = G_ICMP intpred(sle), %t(<4 x s32>), %f |
| ; CHECK-NEXT: $q1 = COPY %c(<4 x s32>) |
| ; CHECK-NEXT: %sel:_(<4 x s32>) = exact G_SELECT %c(<4 x s32>), %t, %f |
| ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %t1:_(s32) = G_TRUNC %0 |
| %f1:_(s32) = G_TRUNC %1 |
| %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1 |
| %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1 |
| %c:_(<4 x s32>) = G_ICMP intpred(sle), %t(<4 x s32>), %f(<4 x s32>) |
| $q1 = COPY %c(<4 x s32>) |
| %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f |
| $q0 = COPY %sel(<4 x s32>) |
| ... |
| --- |
| name: dont_combine_pointer_type |
| body: | |
| bb.1: |
| liveins: $x0 |
| |
| ; CHECK-LABEL: name: dont_combine_pointer_type |
| ; CHECK: liveins: $x0 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(p0) = G_CONSTANT i64 0 |
| ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[C]](p0) :: (load (p0)) |
| ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ugt), [[LOAD]](p0), [[C]] |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ICMP]](s1), [[LOAD]], [[C]] |
| ; CHECK-NEXT: G_STORE [[SELECT]](p0), [[COPY]](p0) :: (store (p0)) |
| ; CHECK-NEXT: $x0 = COPY [[C]](p0) |
| ; CHECK-NEXT: RET_ReallyLR implicit $x0 |
| %0:_(p0) = COPY $x0 |
| %2:_(p0) = G_CONSTANT i64 0 |
| %1:_(p0) = G_LOAD %2(p0) :: (load (p0)) |
| %3:_(s1) = G_ICMP intpred(ugt), %1(p0), %2 |
| %4:_(p0) = G_SELECT %3(s1), %1, %2 |
| G_STORE %4(p0), %0(p0) :: (store (p0)) |
| $x0 = COPY %2(p0) |
| RET_ReallyLR implicit $x0 |
| |
| ... |
| --- |
| name: dont_combine_pointer_type_select_of_constant |
| alignment: 4 |
| liveins: |
| - { reg: '$w0' } |
| - { reg: '$x1' } |
| body: | |
| bb.1: |
| liveins: $w0, $x1 |
| |
| ; CHECK-LABEL: name: dont_combine_pointer_type_select_of_constant |
| ; CHECK: liveins: $w0, $x1 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0 |
| ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32) |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1 |
| ; CHECK-NEXT: [[ASSERT_ZEXT:%[0-9]+]]:_(s8) = G_ASSERT_ZEXT [[TRUNC]], 1 |
| ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ASSERT_ZEXT]](s8) |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(p0) = G_CONSTANT i64 0 |
| ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 |
| ; CHECK-NEXT: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[C1]](s64) |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[TRUNC1]](s1), [[C]], [[INTTOPTR]] |
| ; CHECK-NEXT: G_STORE [[SELECT]](p0), [[COPY1]](p0) :: (store (p0)) |
| ; CHECK-NEXT: RET_ReallyLR |
| %3:_(s32) = COPY $w0 |
| %2:_(s8) = G_TRUNC %3(s32) |
| %1:_(p0) = COPY $x1 |
| %4:_(s8) = G_ASSERT_ZEXT %2, 1 |
| %0:_(s1) = G_TRUNC %4(s8) |
| %6:_(p0) = G_CONSTANT i64 0 |
| %8:_(s64) = G_CONSTANT i64 -1 |
| %7:_(p0) = G_INTTOPTR %8(s64) |
| %5:_(p0) = G_SELECT %0(s1), %6, %7 |
| G_STORE %5(p0), %1(p0) :: (store (p0)) |
| RET_ReallyLR |
| |
| ... |
| --- |
| # test failed select icmp_slef,t_t_f --> smin(t,f) |
| name: select_icmp_sle_f_t_t_f_smin_t_f |
| body: | |
| bb.1: |
| liveins: $x0, $x1, $x2 |
| ; CHECK-LABEL: name: select_icmp_sle_f_t_t_f_smin_t_f |
| ; CHECK: liveins: $x0, $x1, $x2 |
| ; CHECK-NEXT: {{ $}} |
| ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 |
| ; CHECK-NEXT: %t1:_(s32) = G_TRUNC [[COPY]](s64) |
| ; CHECK-NEXT: %f1:_(s32) = G_TRUNC [[COPY1]](s64) |
| ; CHECK-NEXT: %t:_(<4 x s32>) = G_BUILD_VECTOR %t1(s32), %t1(s32), %t1(s32), %t1(s32) |
| ; CHECK-NEXT: %f:_(<4 x s32>) = G_BUILD_VECTOR %f1(s32), %f1(s32), %f1(s32), %f1(s32) |
| ; CHECK-NEXT: %sel:_(<4 x s32>) = G_SMAX %t, %f |
| ; CHECK-NEXT: $q0 = COPY %sel(<4 x s32>) |
| %0:_(s64) = COPY $x0 |
| %1:_(s64) = COPY $x1 |
| %t1:_(s32) = G_TRUNC %0 |
| %f1:_(s32) = G_TRUNC %1 |
| %t:_(<4 x s32>) = G_BUILD_VECTOR %t1, %t1, %t1, %t1 |
| %f:_(<4 x s32>) = G_BUILD_VECTOR %f1, %f1, %f1, %f1 |
| %c:_(<4 x s32>) = G_ICMP intpred(sle), %f(<4 x s32>), %t(<4 x s32>) |
| %sel:_(<4 x s32>) = exact G_SELECT %c, %t, %f |
| $q0 = COPY %sel(<4 x s32>) |
| ... |