llvm/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-ptrtoint-rv32.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=riscv32 -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s

---
name:            p0_s32
body:             |
  bb.0:
    liveins: $x10

    ; CHECK-LABEL: name: p0_s32
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
    ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(p0) = COPY $x10
    %1:_(s32) = G_PTRTOINT %0(p0)
    $x10 = COPY %1(s32)
    PseudoRET implicit $x10

...
---
name:            p0_s16
body:             |
  bb.0:
    liveins: $x10

    ; CHECK-LABEL: name: p0_s16
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
    ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(p0) = COPY $x10
    %1:_(s16) = G_PTRTOINT %0(p0)
    %2:_(s32) = G_ANYEXT %1(s16)
    $x10 = COPY %2(s32)
    PseudoRET implicit $x10

...
---
name:            p0_s8
body:             |
  bb.0:
    liveins: $x10

    ; CHECK-LABEL: name: p0_s8
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
    ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(p0) = COPY $x10
    %1:_(s8) = G_PTRTOINT %0(p0)
    %2:_(s32) = G_ANYEXT %1(s8)
    $x10 = COPY %2(s32)
    PseudoRET implicit $x10

...
---
name:            p0_s1
body:             |
  bb.0:
    liveins: $x10

    ; CHECK-LABEL: name: p0_s1
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
    ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(p0) = COPY $x10
    %1:_(s1) = G_PTRTOINT %0(p0)
    %2:_(s32) = G_ANYEXT %1(s1)
    $x10 = COPY %2(s32)
    PseudoRET implicit $x10

...
---
name:            p0_s64
body:             |
  bb.0:
    liveins: $x10

    ; CHECK-LABEL: name: p0_s64
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
    ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s32)
    ; CHECK-NEXT: $x11 = COPY [[C]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
    %0:_(p0) = COPY $x10
    %1:_(s64) = G_PTRTOINT %0(p0)
    %2:_(s32), %3:_(s32) = G_UNMERGE_VALUES %1(s64)
    $x10 = COPY %2(s32)
    $x11 = COPY %3(s32)
    PseudoRET implicit $x10, implicit $x11

...
---
name:            p0_s44
body:             |
  bb.0:
    liveins: $x10

    ; CHECK-LABEL: name: p0_s44
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
    ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(p0) = COPY $x10
    %1:_(s44) = G_PTRTOINT %0(p0)
    %4:_(s32) = G_TRUNC %1
    $x10 = COPY %4(s32)
    PseudoRET implicit $x10

...