44 lines · plain
1; RUN: llc -mtriple=riscv64 < %s | FileCheck %s --match-full-lines2; RUN: llc -mtriple=riscv32 < %s | FileCheck %s --match-full-lines3 4declare void @extern_func()5 6; CHECK-LABEL: const:7; CHECK-NEXT: .word %pltpcrel(extern_func)8 9;; Note that for riscv32, the ptrtoint will actually upcast the ptr it to an10;; oversized 64-bit pointer that eventually gets truncated. This isn't needed11;; for riscv32, but this unifies the RV64 and RV32 test cases.12@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 14@_ZTV1B = dso_local constant { [7 x i32] } { [7 x i32] [15 i32 0,16 i32 0,17 i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @f0 to i64), i64 ptrtoint (ptr getelementptr inbounds ({ [7 x i32] }, ptr @_ZTV1B, i32 0, i32 0, i32 2) to i64)) to i32),18 i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @f1 to i64), i64 ptrtoint (ptr getelementptr inbounds ({ [7 x i32] }, ptr @_ZTV1B, i32 0, i32 0, i32 2) to i64)) to i32),19 i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @f2 to i64), i64 ptrtoint (ptr getelementptr inbounds ({ [7 x i32] }, ptr @_ZTV1B, i32 0, i32 0, i32 2) to i64)) to i32),20 i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @f3 to i64), i64 ptrtoint (ptr getelementptr inbounds ({ [7 x i32] }, ptr @_ZTV1B, i32 0, i32 0, i32 2) to i64)) to i32),21 i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @f4 to i64), i64 ptrtoint (ptr getelementptr inbounds ({ [7 x i32] }, ptr @_ZTV1B, i32 0, i32 0, i32 2) to i64)) to i32)22] }, align 423 24; CHECK-LABEL: _ZTV1B:25; CHECK-NEXT: .word 0 # 0x026; CHECK-NEXT: .word 0 # 0x027; CHECK-NEXT: .word %pltpcrel(f0)28; CHECK-NEXT: .word %pltpcrel(f1+4)29; CHECK-NEXT: .word %pltpcrel(f2+8)30; CHECK-NEXT: .word %pltpcrel(f3+12)31; CHECK-NEXT: .word %pltpcrel(f4+16)32; CHECK-NEXT: .size _ZTV1B, 2833declare void @f0()34declare void @f1()35define dso_local void @f2() {36 ret void37}38define void @f3() {39 ret void40}41define hidden void @f4() {42 ret void43}44