xref: /llvm-project/llvm/test/CodeGen/RISCV/dso_local_equivalent.ll (revision cdb9a0c086a5b7e0972957be91f5864647b05038)
1*cdb9a0c0SLeonard Chan; RUN: llc -mtriple=riscv64 < %s | FileCheck %s --match-full-lines
2*cdb9a0c0SLeonard Chan; RUN: llc -mtriple=riscv32 < %s | FileCheck %s --match-full-lines
3*cdb9a0c0SLeonard Chan
4*cdb9a0c0SLeonard Chandeclare void @extern_func()
5*cdb9a0c0SLeonard Chan
6*cdb9a0c0SLeonard Chan; CHECK-LABEL: const:
7*cdb9a0c0SLeonard Chan; CHECK-NEXT:    .word   extern_func@PLT-const
8*cdb9a0c0SLeonard Chan
9*cdb9a0c0SLeonard Chan;; Note that for riscv32, the ptrtoint will actually upcast the ptr it to an
10*cdb9a0c0SLeonard Chan;; oversized 64-bit pointer that eventually gets truncated. This isn't needed
11*cdb9a0c0SLeonard Chan;; for riscv32, but this unifies the RV64 and RV32 test cases.
12*cdb9a0c0SLeonard Chan@const = dso_local constant i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @extern_func to i64), i64 ptrtoint (ptr @const to i64)) to i32)
13