llvm-project/llvm/test/CodeGen/X86/GlobalISel/ptrtoint.ll

57 lines
1.4 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=CHECK
define i1 @ptrtoint_s1_p0(i64* %p) {
; CHECK-LABEL: ptrtoint_s1_p0:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: # kill: def $al killed $al killed $rax
; CHECK-NEXT: retq
entry:
%0 = ptrtoint i64* %p to i1
ret i1 %0
}
define i8 @ptrtoint_s8_p0(i64* %p) {
; CHECK-LABEL: ptrtoint_s8_p0:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: # kill: def $al killed $al killed $rax
; CHECK-NEXT: retq
entry:
%0 = ptrtoint i64* %p to i8
ret i8 %0
}
define i16 @ptrtoint_s16_p0(i64* %p) {
; CHECK-LABEL: ptrtoint_s16_p0:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: # kill: def $ax killed $ax killed $rax
; CHECK-NEXT: retq
entry:
%0 = ptrtoint i64* %p to i16
ret i16 %0
}
define i32 @ptrtoint_s32_p0(i64* %p) {
; CHECK-LABEL: ptrtoint_s32_p0:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: # kill: def $eax killed $eax killed $rax
; CHECK-NEXT: retq
entry:
%0 = ptrtoint i64* %p to i32
ret i32 %0
}
define i64 @ptrtoint_s64_p0(i64* %p) {
; CHECK-LABEL: ptrtoint_s64_p0:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: retq
entry:
%0 = ptrtoint i64* %p to i64
ret i64 %0
}