llvm/llvm/test/CodeGen/AArch64/machine-combiner-eor.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=aarch64-none-linux-gnu -mcpu=neoverse-n2 -run-pass machine-combiner \
# RUN:     -verify-machineinstrs  -o - %s | FileCheck %s

# Most machine-combiner reassociation tests are put in machine-combiner.ll.
# However, we cannot test reassociation of SVE EORs in machine-combiner.ll
# because isel combines two EORs to one EOR3. So SVE EOR-specific test is put
# in this file.

---

name:            reassociate_xors_sve_1
registers:
  - { id: 0, class: zpr, preferred-register: '' }
  - { id: 1, class: zpr, preferred-register: '' }
  - { id: 2, class: zpr, preferred-register: '' }
  - { id: 3, class: zpr, preferred-register: '' }
  - { id: 4, class: zpr, preferred-register: '' }
  - { id: 5, class: zpr, preferred-register: '' }
  - { id: 6, class: zpr, preferred-register: '' }
body:             |
  bb.0:
    liveins: $z0, $z1, $z2, $z3

    ; CHECK-LABEL: name: reassociate_xors_sve_1
    ; CHECK: liveins: $z0, $z1, $z2, $z3
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:zpr = COPY $z3
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:zpr = COPY $z2
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:zpr = COPY $z1
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:zpr = COPY $z0
    ; CHECK-NEXT: [[EOR_ZZZ:%[0-9]+]]:zpr = EOR_ZZZ [[COPY3]], [[COPY2]]
    ; CHECK-NEXT: [[EOR_ZZZ1:%[0-9]+]]:zpr = EOR_ZZZ [[COPY1]], [[COPY]]
    ; CHECK-NEXT: [[EOR_ZZZ2:%[0-9]+]]:zpr = EOR_ZZZ killed [[EOR_ZZZ]], killed [[EOR_ZZZ1]]
    ; CHECK-NEXT: $z0 = COPY [[EOR_ZZZ2]]
    ; CHECK-NEXT: RET_ReallyLR implicit $z0
    %3:zpr = COPY $z3
    %2:zpr = COPY $z2
    %1:zpr = COPY $z1
    %0:zpr = COPY $z0
    %4:zpr = EOR_ZZZ %0, %1
    %5:zpr = EOR_ZZZ killed %4, %2
    %6:zpr = EOR_ZZZ killed %5, %3
    $z0 = COPY %6
    RET_ReallyLR implicit $z0

...
---

name:            reassociate_xors_sve_2
registers:
  - { id: 0, class: zpr, preferred-register: '' }
  - { id: 1, class: zpr, preferred-register: '' }
  - { id: 2, class: zpr, preferred-register: '' }
  - { id: 3, class: zpr, preferred-register: '' }
  - { id: 4, class: zpr, preferred-register: '' }
  - { id: 5, class: zpr, preferred-register: '' }
  - { id: 6, class: zpr, preferred-register: '' }
body:             |
  bb.0:
    liveins: $z0, $z1, $z2, $z3

    ; CHECK-LABEL: name: reassociate_xors_sve_2
    ; CHECK: liveins: $z0, $z1, $z2, $z3
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:zpr = COPY $z3
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:zpr = COPY $z2
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:zpr = COPY $z1
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:zpr = COPY $z0
    ; CHECK-NEXT: [[AND_ZZZ:%[0-9]+]]:zpr = AND_ZZZ [[COPY3]], [[COPY2]]
    ; CHECK-NEXT: [[EOR_ZZZ:%[0-9]+]]:zpr = EOR_ZZZ [[COPY1]], [[COPY]]
    ; CHECK-NEXT: [[EOR_ZZZ1:%[0-9]+]]:zpr = EOR_ZZZ killed [[AND_ZZZ]], killed [[EOR_ZZZ]]
    ; CHECK-NEXT: $z0 = COPY [[EOR_ZZZ1]]
    ; CHECK-NEXT: RET_ReallyLR implicit $z0
    %3:zpr = COPY $z3
    %2:zpr = COPY $z2
    %1:zpr = COPY $z1
    %0:zpr = COPY $z0
    %4:zpr = AND_ZZZ %0, %1
    %5:zpr = EOR_ZZZ killed %4, %2
    %6:zpr = EOR_ZZZ killed %5, %3
    $z0 = COPY %6
    RET_ReallyLR implicit $z0

...