llvm-project/llvm/test/CodeGen/X86/ptrtoaddr-fast-isel.ll
Nikita Popov ea78bfae78 [FastISel] Add support for ptrtoaddr
Handle it the same as ptrtoint. For ptrtoaddr the resulting integer
size is guaranteed to match the address size. For the case where
address size and pointer size match, this will be a no-op. For the
case where the address size is smaller than the pointer size, this
will be a truncate (but this is not testable with in-tree targets).
2025-10-08 16:34:14 +02:00

12 lines
360 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=x86_64-linux-gnu -fast-isel -fast-isel-abort=1 < %s -o - | FileCheck %s
define i64 @ptrtoaddr(ptr %p) {
; CHECK-LABEL: ptrtoaddr:
; CHECK: # %bb.0:
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: retq
%addr = ptrtoaddr ptr %p to i64
ret i64 %addr
}