| # RUN: llc -O0 -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s |
| |
| --- | |
| target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" |
| |
| define void @xor_s32_gpr() { ret void } |
| define void @xor_s64_gpr() { ret void } |
| define void @xor_constant_n1_s32_gpr() { ret void } |
| define void @xor_constant_n1_s64_gpr() { ret void } |
| define void @xor_constant_n1_s32_gpr_2bb() { ret void } |
| |
| ... |
| |
| --- |
| # Check that we select a 32-bit GPR G_XOR into EORWrr on GPR32. |
| # Also check that we constrain the register class of the COPY to GPR32. |
| # CHECK-LABEL: name: xor_s32_gpr |
| name: xor_s32_gpr |
| legalized: true |
| regBankSelected: true |
| |
| # CHECK: registers: |
| # CHECK-NEXT: - { id: 0, class: gpr32, preferred-register: '' } |
| # CHECK-NEXT: - { id: 1, class: gpr32, preferred-register: '' } |
| # CHECK-NEXT: - { id: 2, class: gpr32, preferred-register: '' } |
| registers: |
| - { id: 0, class: gpr } |
| - { id: 1, class: gpr } |
| - { id: 2, class: gpr } |
| |
| # CHECK: body: |
| # CHECK: %0 = COPY %w0 |
| # CHECK: %1 = COPY %w1 |
| # CHECK: %2 = EORWrr %0, %1 |
| body: | |
| bb.0: |
| liveins: %w0, %w1 |
| |
| %0(s32) = COPY %w0 |
| %1(s32) = COPY %w1 |
| %2(s32) = G_XOR %0, %1 |
| %w0 = COPY %2(s32) |
| ... |
| |
| --- |
| # Same as xor_s64_gpr, for 64-bit operations. |
| # CHECK-LABEL: name: xor_s64_gpr |
| name: xor_s64_gpr |
| legalized: true |
| regBankSelected: true |
| |
| # CHECK: registers: |
| # CHECK-NEXT: - { id: 0, class: gpr64, preferred-register: '' } |
| # CHECK-NEXT: - { id: 1, class: gpr64, preferred-register: '' } |
| # CHECK-NEXT: - { id: 2, class: gpr64, preferred-register: '' } |
| registers: |
| - { id: 0, class: gpr } |
| - { id: 1, class: gpr } |
| - { id: 2, class: gpr } |
| |
| # CHECK: body: |
| # CHECK: %0 = COPY %x0 |
| # CHECK: %1 = COPY %x1 |
| # CHECK: %2 = EORXrr %0, %1 |
| body: | |
| bb.0: |
| liveins: %x0, %x1 |
| |
| %0(s64) = COPY %x0 |
| %1(s64) = COPY %x1 |
| %2(s64) = G_XOR %0, %1 |
| %x0 = COPY %2(s64) |
| ... |
| |
| --- |
| # Check that we select a 32-bit GPR G_XOR into EORWrr on GPR32. |
| # Also check that we constrain the register class of the COPY to GPR32. |
| # CHECK-LABEL: name: xor_constant_n1_s32_gpr |
| name: xor_constant_n1_s32_gpr |
| legalized: true |
| regBankSelected: true |
| |
| # CHECK: registers: |
| # CHECK-NEXT: - { id: 0, class: gpr32, preferred-register: '' } |
| # CHECK-NEXT: - { id: 1, class: gpr, preferred-register: '' } |
| # CHECK-NEXT: - { id: 2, class: gpr32, preferred-register: '' } |
| registers: |
| - { id: 0, class: gpr } |
| - { id: 1, class: gpr } |
| - { id: 2, class: gpr } |
| |
| # CHECK: body: |
| # CHECK: %0 = COPY %w0 |
| # CHECK: %2 = ORNWrr %wzr, %0 |
| body: | |
| bb.0: |
| liveins: %w0 |
| |
| %0(s32) = COPY %w0 |
| %1(s32) = G_CONSTANT i32 -1 |
| %2(s32) = G_XOR %0, %1 |
| %w0 = COPY %2(s32) |
| ... |
| |
| --- |
| # Same as xor_constant_n1_s64_gpr, for 64-bit operations. |
| # CHECK-LABEL: name: xor_constant_n1_s64_gpr |
| name: xor_constant_n1_s64_gpr |
| legalized: true |
| regBankSelected: true |
| |
| # CHECK: registers: |
| # CHECK-NEXT: - { id: 0, class: gpr64, preferred-register: '' } |
| # CHECK-NEXT: - { id: 1, class: gpr, preferred-register: '' } |
| # CHECK-NEXT: - { id: 2, class: gpr64, preferred-register: '' } |
| registers: |
| - { id: 0, class: gpr } |
| - { id: 1, class: gpr } |
| - { id: 2, class: gpr } |
| |
| # CHECK: body: |
| # CHECK: %0 = COPY %x0 |
| # CHECK: %2 = ORNXrr %xzr, %0 |
| body: | |
| bb.0: |
| liveins: %x0 |
| |
| %0(s64) = COPY %x0 |
| %1(s64) = G_CONSTANT i64 -1 |
| %2(s64) = G_XOR %0, %1 |
| %x0 = COPY %2(s64) |
| ... |
| |
| --- |
| # Check that we can obtain constants from other basic blocks. |
| # CHECK-LABEL: name: xor_constant_n1_s32_gpr_2bb |
| name: xor_constant_n1_s32_gpr_2bb |
| legalized: true |
| regBankSelected: true |
| |
| # CHECK: registers: |
| # CHECK-NEXT: - { id: 0, class: gpr32, preferred-register: '' } |
| # CHECK-NEXT: - { id: 1, class: gpr, preferred-register: '' } |
| # CHECK-NEXT: - { id: 2, class: gpr32, preferred-register: '' } |
| registers: |
| - { id: 0, class: gpr } |
| - { id: 1, class: gpr } |
| - { id: 2, class: gpr } |
| |
| # CHECK: body: |
| # CHECK: B %bb.1 |
| # CHECK: %0 = COPY %w0 |
| # CHECK: %2 = ORNWrr %wzr, %0 |
| |
| body: | |
| bb.0: |
| liveins: %w0, %w1 |
| successors: %bb.1 |
| %1(s32) = G_CONSTANT i32 -1 |
| G_BR %bb.1 |
| bb.1: |
| %0(s32) = COPY %w0 |
| %2(s32) = G_XOR %0, %1 |
| %w0 = COPY %2(s32) |
| ... |