1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=aarch64-unknown-unknown -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
3#
4# Test patterns related to logical_shifted_reg32/logical_shifted_reg64 which
5# are not shared with arith_shifted_reg32/arith_shifted_reg64.
6
7---
8name:            and_xor_bicxrs
9legalized:       true
10regBankSelected: true
11tracksRegLiveness: true
12body:             |
13  bb.0:
14    liveins: $x0
15    ; CHECK-LABEL: name: and_xor_bicxrs
16    ; CHECK: liveins: $x0
17    ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
18    ; CHECK: [[BICXrs:%[0-9]+]]:gpr64 = BICXrs [[COPY]], [[COPY]], 8
19    ; CHECK: $x0 = COPY [[BICXrs]]
20    ; CHECK: RET_ReallyLR implicit $x0
21    %0:gpr(s64) = COPY $x0
22    %1:gpr(s64) = G_CONSTANT i64 8
23    %2:gpr(s64) = G_CONSTANT i64 -1
24    %3:gpr(s64) = G_SHL %0, %1:gpr(s64)
25    %4:gpr(s64) = G_XOR %3, %2:gpr(s64)
26    %5:gpr(s64) = G_AND %0, %4:gpr(s64)
27    $x0 = COPY %5:gpr(s64)
28    RET_ReallyLR implicit $x0
29...
30---
31name:            or_xor_ornxrs
32legalized:       true
33regBankSelected: true
34tracksRegLiveness: true
35body:             |
36  bb.0:
37    liveins: $x0
38    ; CHECK-LABEL: name: or_xor_ornxrs
39    ; CHECK: liveins: $x0
40    ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
41    ; CHECK: [[ORNXrs:%[0-9]+]]:gpr64 = ORNXrs [[COPY]], [[COPY]], 8
42    ; CHECK: $x0 = COPY [[ORNXrs]]
43    ; CHECK: RET_ReallyLR implicit $x0
44    %0:gpr(s64) = COPY $x0
45    %1:gpr(s64) = G_CONSTANT i64 8
46    %2:gpr(s64) = G_CONSTANT i64 -1
47    %3:gpr(s64) = G_SHL %0, %1:gpr(s64)
48    %4:gpr(s64) = G_XOR %3, %2:gpr(s64)
49    %5:gpr(s64) = G_OR %0, %4:gpr(s64)
50    $x0 = COPY %5:gpr(s64)
51    RET_ReallyLR implicit $x0
52...
53---
54name:            xor_xor_eonxrs
55legalized:       true
56regBankSelected: true
57tracksRegLiveness: true
58body:             |
59  bb.0:
60    liveins: $x0
61    ; CHECK-LABEL: name: xor_xor_eonxrs
62    ; CHECK: liveins: $x0
63    ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
64    ; CHECK: [[EONXrs:%[0-9]+]]:gpr64 = EONXrs [[COPY]], [[COPY]], 8
65    ; CHECK: $x0 = COPY [[EONXrs]]
66    ; CHECK: RET_ReallyLR implicit $x0
67    %0:gpr(s64) = COPY $x0
68    %1:gpr(s64) = G_CONSTANT i64 8
69    %2:gpr(s64) = G_CONSTANT i64 -1
70    %3:gpr(s64) = G_SHL %0, %1:gpr(s64)
71    %4:gpr(s64) = G_XOR %3, %2:gpr(s64)
72    %5:gpr(s64) = G_XOR %0, %4:gpr(s64)
73    $x0 = COPY %5:gpr(s64)
74    RET_ReallyLR implicit $x0
75...
76