legalize-ptrmask.mir 6.74 KB
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck %s

---
name: ptrmask_p1_s16
body: |
  bb.0:
    liveins: $vgpr0_vgpr1, $vgpr2

    ; CHECK-LABEL: name: ptrmask_p1_s16
    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
    ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY1]](s32)
    ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p1) = G_PTRMASK [[COPY]], [[AND]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p1)
    %0:_(p1) = COPY $vgpr0_vgpr1
    %1:_(s32) = COPY $vgpr2
    %2:_(s16) = G_TRUNC %1
    %3:_(p1) = G_PTRMASK %0, %2
    $vgpr0_vgpr1 = COPY %3
...

---
name: ptrmask_p1_s32
body: |
  bb.0:
    liveins: $vgpr0_vgpr1, $vgpr2

    ; CHECK-LABEL: name: ptrmask_p1_s32
    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p1) = G_PTRMASK [[COPY]], [[ZEXT]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p1)
    %0:_(p1) = COPY $vgpr0_vgpr1
    %1:_(s32) = COPY $vgpr2
    %2:_(p1) = G_PTRMASK %0, %1
    $vgpr0_vgpr1 = COPY %2
...

---
name: ptrmask_p1_s64
body: |
  bb.0:
    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3

    ; CHECK-LABEL: name: ptrmask_p1_s64
    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p1) = G_PTRMASK [[COPY]], [[COPY1]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p1)
    %0:_(p1) = COPY $vgpr0_vgpr1
    %1:_(s64) = COPY $vgpr2_vgpr3
    %2:_(p1) = G_PTRMASK %0, %1
    $vgpr0_vgpr1 = COPY %2
...

---
name: ptrmask_p1_s96
body: |
  bb.0:
    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3_vgpr4

    ; CHECK-LABEL: name: ptrmask_p1_s96
    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
    ; CHECK: [[COPY1:%[0-9]+]]:_(s96) = COPY $vgpr2_vgpr3_vgpr4
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s96)
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p1) = G_PTRMASK [[COPY]], [[TRUNC]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p1)
    %0:_(p1) = COPY $vgpr0_vgpr1
    %1:_(s96) = COPY $vgpr2_vgpr3_vgpr4
    %2:_(p1) = G_PTRMASK %0, %1
    $vgpr0_vgpr1 = COPY %2
...

---
name: ptrmask_p0_s16
body: |
  bb.0:
    liveins: $vgpr0_vgpr1, $vgpr2

    ; CHECK-LABEL: name: ptrmask_p0_s16
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
    ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY1]](s32)
    ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p0) = G_PTRMASK [[COPY]], [[AND]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p0)
    %0:_(p0) = COPY $vgpr0_vgpr1
    %1:_(s32) = COPY $vgpr2
    %2:_(s16) = G_TRUNC %1
    %3:_(p0) = G_PTRMASK %0, %2
    $vgpr0_vgpr1 = COPY %3
...

---
name: ptrmask_p0_s32
body: |
  bb.0:
    liveins: $vgpr0_vgpr1, $vgpr2

    ; CHECK-LABEL: name: ptrmask_p0_s32
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p0) = G_PTRMASK [[COPY]], [[ZEXT]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p0)
    %0:_(p0) = COPY $vgpr0_vgpr1
    %1:_(s32) = COPY $vgpr2
    %2:_(p0) = G_PTRMASK %0, %1
    $vgpr0_vgpr1 = COPY %2
...

---
name: ptrmask_p0_s64
body: |
  bb.0:
    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3

    ; CHECK-LABEL: name: ptrmask_p0_s64
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p0) = G_PTRMASK [[COPY]], [[COPY1]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p0)
    %0:_(p0) = COPY $vgpr0_vgpr1
    %1:_(s64) = COPY $vgpr2_vgpr3
    %2:_(p0) = G_PTRMASK %0, %1
    $vgpr0_vgpr1 = COPY %2
...

---
name: ptrmask_p0_s96
body: |
  bb.0:
    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3_vgpr4

    ; CHECK-LABEL: name: ptrmask_p0_s96
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
    ; CHECK: [[COPY1:%[0-9]+]]:_(s96) = COPY $vgpr2_vgpr3_vgpr4
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s96)
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p0) = G_PTRMASK [[COPY]], [[TRUNC]](s64)
    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRMASK]](p0)
    %0:_(p0) = COPY $vgpr0_vgpr1
    %1:_(s96) = COPY $vgpr2_vgpr3_vgpr4
    %2:_(p0) = G_PTRMASK %0, %1
    $vgpr0_vgpr1 = COPY %2
...

---
name: ptrmask_p3_s16
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1

    ; CHECK-LABEL: name: ptrmask_p3_s16
    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p3) = G_PTRMASK [[COPY]], [[AND]](s32)
    ; CHECK: $vgpr0 = COPY [[PTRMASK]](p3)
    %0:_(p3) = COPY $vgpr0
    %1:_(s32) = COPY $vgpr1
    %2:_(s16) = G_TRUNC %1
    %3:_(p3) = G_PTRMASK %0, %2
    $vgpr0 = COPY %3
...

---
name: ptrmask_p3_s32
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1

    ; CHECK-LABEL: name: ptrmask_p3_s32
    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p3) = G_PTRMASK [[COPY]], [[COPY1]](s32)
    ; CHECK: $vgpr0 = COPY [[PTRMASK]](p3)
    %0:_(p3) = COPY $vgpr0
    %1:_(s32) = COPY $vgpr1
    %2:_(p3) = G_PTRMASK %0, %1
    $vgpr0 = COPY %2
...

---
name: ptrmask_p3_s64
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1_vgpr2

    ; CHECK-LABEL: name: ptrmask_p3_s64
    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr1_vgpr2
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p3) = G_PTRMASK [[COPY]], [[TRUNC]](s32)
    ; CHECK: $vgpr0 = COPY [[PTRMASK]](p3)
    %0:_(p3) = COPY $vgpr0
    %1:_(s64) = COPY $vgpr1_vgpr2
    %2:_(p3) = G_PTRMASK %0, %1
    $vgpr0 = COPY %2
...

---
name: ptrmask_p3_s96
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1_vgpr2_vgpr3

    ; CHECK-LABEL: name: ptrmask_p3_s96
    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s96) = COPY $vgpr1_vgpr2_vgpr3
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s96)
    ; CHECK: [[PTRMASK:%[0-9]+]]:_(p3) = G_PTRMASK [[COPY]], [[TRUNC]](s32)
    ; CHECK: $vgpr0 = COPY [[PTRMASK]](p3)
    %0:_(p3) = COPY $vgpr0
    %1:_(s96) = COPY $vgpr1_vgpr2_vgpr3
    %2:_(p3) = G_PTRMASK %0, %1
    $vgpr0 = COPY %2
...