legalize-or.mir 1.93 KB
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O0 -mtriple=aarch64-apple-ios -run-pass=legalizer %s -o - | FileCheck %s

---
name:            test_scalar_or_small
body: |
  bb.0:
    liveins: $x0, $x1, $x2, $x3
    ; CHECK-LABEL: name: test_scalar_or_small
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[TRUNC]], [[TRUNC1]]
    ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[OR]](s32)
    ; CHECK: $x0 = COPY [[ANYEXT]](s64)
    %0:_(s64) = COPY $x0
    %1:_(s64) = COPY $x1
    %2:_(s8) = G_TRUNC %0
    %3:_(s8) = G_TRUNC %1
    %4:_(s8) = G_OR %2, %3
    %5:_(s64) = G_ANYEXT %4
    $x0 = COPY %5
...

---
name:            test_big_scalar_power_of_2
body: |
  bb.0:
    liveins: $x0, $x1, $x2, $x3
    ; We have a temporary G_MERGE_VALUES in the legalizer that gets
    ; cleaned up with the G_UNMERGE_VALUES, so we end up directly
    ; copying the results of the G_OR ops.

    ; CHECK-LABEL: name: test_big_scalar_power_of_2
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
    ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
    ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $x3
    ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[COPY]], [[COPY2]]
    ; CHECK: [[OR1:%[0-9]+]]:_(s64) = G_OR [[COPY1]], [[COPY3]]
    ; CHECK: $x0 = COPY [[OR]](s64)
    ; CHECK: $x1 = COPY [[OR1]](s64)
    ; CHECK: RET_ReallyLR implicit $x0, implicit $x1
    %0:_(s64) = COPY $x0
    %1:_(s64) = COPY $x1
    %2:_(s64) = COPY $x2
    %3:_(s64) = COPY $x3
    %4:_(s128) = G_MERGE_VALUES %0, %1
    %5:_(s128) = G_MERGE_VALUES %2, %3
    %6:_(s128) = G_OR %4, %5
    %7:_(s64), %8:_(s64) = G_UNMERGE_VALUES %6
    $x0 = COPY %7
    $x1 = COPY %8
    RET_ReallyLR implicit $x0, implicit $x1
...