1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
|
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs -mtriple aarch64-unknown- --aarch64postlegalizercombiner-only-enable-rule="select_to_logical" %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: [[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: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
; 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: [[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: [[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: [[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: [[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: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x2
; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
; CHECK-NEXT: %f:_(s1) = G_TRUNC [[COPY1]](s64)
; CHECK-NEXT: %sel:_(s1) = G_OR %c, %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
%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: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x2
; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
; CHECK-NEXT: %f:_(s1) = G_TRUNC [[COPY1]](s64)
; CHECK-NEXT: %sel:_(s1) = G_OR %c, %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
%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: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d2
; CHECK-NEXT: %c:_(<2 x s1>) = G_TRUNC [[COPY]](<2 x s32>)
; CHECK-NEXT: %f:_(<2 x s1>) = G_TRUNC [[COPY1]](<2 x s32>)
; CHECK-NEXT: %sel:_(<2 x s1>) = G_OR %c, %f
; CHECK-NEXT: %ext:_(<2 x s32>) = G_ANYEXT %sel(<2 x s1>)
; CHECK-NEXT: $d0 = COPY %ext(<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: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
; CHECK-NEXT: %t:_(s1) = G_TRUNC [[COPY1]](s64)
; CHECK-NEXT: %sel:_(s1) = G_AND %c, %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, %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: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
; CHECK-NEXT: %t:_(s1) = G_TRUNC [[COPY1]](s64)
; CHECK-NEXT: %sel:_(s1) = G_AND %c, %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
%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: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
; CHECK-NEXT: %t:_(s1) = G_TRUNC [[COPY1]](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: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x2
; CHECK-NEXT: %c:_(s1) = G_TRUNC [[COPY]](s64)
; CHECK-NEXT: %f:_(s1) = G_TRUNC [[COPY1]](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)
...
|