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

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

---
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]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s64)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(p0) = COPY $x10
    %1:_(s64) = G_PTRTOINT %0(p0)
    $x10 = COPY %1(s64)
    PseudoRET implicit $x10

...
---
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]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s64)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(p0) = COPY $x10
    %1:_(s32) = G_PTRTOINT %0(p0)
    %2:_(s64) = G_ANYEXT %1(s32)
    $x10 = COPY %2(s64)
    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]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s64)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(p0) = COPY $x10
    %1:_(s16) = G_PTRTOINT %0(p0)
    %2:_(s64) = G_ANYEXT %1(s16)
    $x10 = COPY %2(s64)
    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]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s64)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(p0) = COPY $x10
    %1:_(s8) = G_PTRTOINT %0(p0)
    %2:_(s64) = G_ANYEXT %1(s8)
    $x10 = COPY %2(s64)
    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]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
    ; CHECK-NEXT: $x10 = COPY [[PTRTOINT]](s64)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(p0) = COPY $x10
    %1:_(s1) = G_PTRTOINT %0(p0)
    %2:_(s64) = G_ANYEXT %1(s1)
    $x10 = COPY %2(s64)
    PseudoRET implicit $x10

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

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

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

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

...