Compiler projects using llvm
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s

--- |

  define i1 @ptrtoint_s1_p0(i64* %p) {
  entry:
    %0 = ptrtoint i64* %p to i1
    ret i1 %0
  }

  define i8 @ptrtoint_s8_p0(i64* %p) {
  entry:
    %0 = ptrtoint i64* %p to i8
    ret i8 %0
  }

  define i16 @ptrtoint_s16_p0(i64* %p) {
  entry:
    %0 = ptrtoint i64* %p to i16
    ret i16 %0
  }

  define i32 @ptrtoint_s32_p0(i64* %p) {
  entry:
    %0 = ptrtoint i64* %p to i32
    ret i32 %0
  }

  define i64 @ptrtoint_s64_p0(i64* %p) {
  entry:
    %0 = ptrtoint i64* %p to i64
    ret i64 %0
  }

...
---
name:            ptrtoint_s1_p0
alignment:       16
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
  - { id: 2, class: _ }
body:             |
  bb.1.entry:
    liveins: $rdi

    ; CHECK-LABEL: name: ptrtoint_s1_p0
    ; CHECK: liveins: $rdi
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s1) = G_PTRTOINT [[COPY]](p0)
    ; CHECK: [[ANYEXT:%[0-9]+]]:_(s8) = G_ANYEXT [[PTRTOINT]](s1)
    ; CHECK: $al = COPY [[ANYEXT]](s8)
    ; CHECK: RET 0, implicit $al
    %0:_(p0) = COPY $rdi
    %1:_(s1) = G_PTRTOINT %0(p0)
    %2:_(s8) = G_ANYEXT %1(s1)
    $al = COPY %2(s8)
    RET 0, implicit $al

...
---
name:            ptrtoint_s8_p0
alignment:       16
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
body:             |
  bb.1.entry:
    liveins: $rdi

    ; CHECK-LABEL: name: ptrtoint_s8_p0
    ; CHECK: liveins: $rdi
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s8) = G_PTRTOINT [[COPY]](p0)
    ; CHECK: $al = COPY [[PTRTOINT]](s8)
    ; CHECK: RET 0, implicit $al
    %0:_(p0) = COPY $rdi
    %1:_(s8) = G_PTRTOINT %0(p0)
    $al = COPY %1(s8)
    RET 0, implicit $al

...
---
name:            ptrtoint_s16_p0
alignment:       16
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
body:             |
  bb.1.entry:
    liveins: $rdi

    ; CHECK-LABEL: name: ptrtoint_s16_p0
    ; CHECK: liveins: $rdi
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s16) = G_PTRTOINT [[COPY]](p0)
    ; CHECK: $ax = COPY [[PTRTOINT]](s16)
    ; CHECK: RET 0, implicit $ax
    %0:_(p0) = COPY $rdi
    %1:_(s16) = G_PTRTOINT %0(p0)
    $ax = COPY %1(s16)
    RET 0, implicit $ax

...
---
name:            ptrtoint_s32_p0
alignment:       16
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
body:             |
  bb.1.entry:
    liveins: $rdi

    ; CHECK-LABEL: name: ptrtoint_s32_p0
    ; CHECK: liveins: $rdi
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p0)
    ; CHECK: $eax = COPY [[PTRTOINT]](s32)
    ; CHECK: RET 0, implicit $eax
    %0:_(p0) = COPY $rdi
    %1:_(s32) = G_PTRTOINT %0(p0)
    $eax = COPY %1(s32)
    RET 0, implicit $eax

...
---
name:            ptrtoint_s64_p0
alignment:       16
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
body:             |
  bb.1.entry:
    liveins: $rdi

    ; CHECK-LABEL: name: ptrtoint_s64_p0
    ; CHECK: liveins: $rdi
    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
    ; CHECK: $rax = COPY [[PTRTOINT]](s64)
    ; CHECK: RET 0, implicit $rax
    %0:_(p0) = COPY $rdi
    %1:_(s64) = G_PTRTOINT %0(p0)
    $rax = COPY %1(s64)
    RET 0, implicit $rax

...