1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
7 define void @xor_s32_gpr() { ret void }
8 define void @xor_s64_gpr() { ret void }
9 define void @xor_constant_n1_s32_gpr() { ret void }
10 define void @xor_constant_n1_s64_gpr() { ret void }
11 define void @xor_constant_n1_s32_gpr_2bb() { ret void }
16 # Check that we select a 32-bit GPR G_XOR into EORWrr on GPR32.
17 # Also check that we constrain the register class of the COPY to GPR32.
23 - { id: 0, class: gpr }
24 - { id: 1, class: gpr }
25 - { id: 2, class: gpr }
31 ; CHECK-LABEL: name: xor_s32_gpr
32 ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
33 ; CHECK: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
34 ; CHECK: [[EORWrr:%[0-9]+]]:gpr32 = EORWrr [[COPY]], [[COPY1]]
35 ; CHECK: $w0 = COPY [[EORWrr]]
38 %2(s32) = G_XOR %0, %1
43 # Same as xor_s64_gpr, for 64-bit operations.
49 - { id: 0, class: gpr }
50 - { id: 1, class: gpr }
51 - { id: 2, class: gpr }
57 ; CHECK-LABEL: name: xor_s64_gpr
58 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
59 ; CHECK: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
60 ; CHECK: [[EORXrr:%[0-9]+]]:gpr64 = EORXrr [[COPY]], [[COPY1]]
61 ; CHECK: $x0 = COPY [[EORXrr]]
64 %2(s64) = G_XOR %0, %1
69 # Check that we select a 32-bit GPR G_XOR into EORWrr on GPR32.
70 # Also check that we constrain the register class of the COPY to GPR32.
71 name: xor_constant_n1_s32_gpr
76 - { id: 0, class: gpr }
77 - { id: 1, class: gpr }
78 - { id: 2, class: gpr }
84 ; CHECK-LABEL: name: xor_constant_n1_s32_gpr
85 ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
86 ; CHECK: [[ORNWrr:%[0-9]+]]:gpr32 = ORNWrr $wzr, [[COPY]]
87 ; CHECK: $w0 = COPY [[ORNWrr]]
89 %1(s32) = G_CONSTANT i32 -1
90 %2(s32) = G_XOR %0, %1
95 # Same as xor_constant_n1_s64_gpr, for 64-bit operations.
96 name: xor_constant_n1_s64_gpr
101 - { id: 0, class: gpr }
102 - { id: 1, class: gpr }
103 - { id: 2, class: gpr }
109 ; CHECK-LABEL: name: xor_constant_n1_s64_gpr
110 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
111 ; CHECK: [[ORNXrr:%[0-9]+]]:gpr64 = ORNXrr $xzr, [[COPY]]
112 ; CHECK: $x0 = COPY [[ORNXrr]]
114 %1(s64) = G_CONSTANT i64 -1
115 %2(s64) = G_XOR %0, %1
120 # Check that we can obtain constants from other basic blocks.
121 name: xor_constant_n1_s32_gpr_2bb
123 regBankSelected: true
126 - { id: 0, class: gpr }
127 - { id: 1, class: gpr }
128 - { id: 2, class: gpr }
132 ; CHECK-LABEL: name: xor_constant_n1_s32_gpr_2bb
134 ; CHECK: successors: %bb.1(0x80000000)
137 ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
138 ; CHECK: [[ORNWrr:%[0-9]+]]:gpr32 = ORNWrr $wzr, [[COPY]]
139 ; CHECK: $w0 = COPY [[ORNWrr]]
143 %1(s32) = G_CONSTANT i32 -1
147 %2(s32) = G_XOR %0, %1