llvm-project/llvm/test/CodeGen/LoongArch/thread-pointer.ll
WANG Xuerui f89f0990db [LoongArch] Support llvm.thread.pointer
For `__builtin_thread_pointer` to work, among other things.

Similar to D76828 for RISCV.

Differential Revision: https://reviews.llvm.org/D134368
2022-09-26 09:56:42 +08:00

15 lines
427 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s --mtriple=loongarch32 | FileCheck %s
; RUN: llc < %s --mtriple=loongarch64 | FileCheck %s
declare ptr @llvm.thread.pointer()
define ptr @thread_pointer() nounwind {
; CHECK-LABEL: thread_pointer:
; CHECK: # %bb.0:
; CHECK-NEXT: move $a0, $tp
; CHECK-NEXT: ret
%1 = tail call ptr @llvm.thread.pointer()
ret ptr %1
}