1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 -mattr=+d < %s | FileCheck %s --check-prefix=LA32
3 ; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s --check-prefix=LA64
5 @addr = dso_local global ptr null
7 define void @test_blockaddress() nounwind {
8 ; LA32-LABEL: test_blockaddress:
10 ; LA32-NEXT: pcalau12i $a0, %pc_hi20(addr)
11 ; LA32-NEXT: addi.w $a0, $a0, %pc_lo12(addr)
12 ; LA32-NEXT: pcalau12i $a1, %pc_hi20(.Ltmp0)
13 ; LA32-NEXT: addi.w $a1, $a1, %pc_lo12(.Ltmp0)
14 ; LA32-NEXT: st.w $a1, $a0, 0
15 ; LA32-NEXT: ld.w $a0, $a0, 0
17 ; LA32-NEXT: .Ltmp0: # Block address taken
18 ; LA32-NEXT: .LBB0_1: # %block
21 ; LA64-LABEL: test_blockaddress:
23 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(addr)
24 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(addr)
25 ; LA64-NEXT: pcalau12i $a1, %pc_hi20(.Ltmp0)
26 ; LA64-NEXT: addi.d $a1, $a1, %pc_lo12(.Ltmp0)
27 ; LA64-NEXT: st.d $a1, $a0, 0
28 ; LA64-NEXT: ld.d $a0, $a0, 0
30 ; LA64-NEXT: .Ltmp0: # Block address taken
31 ; LA64-NEXT: .LBB0_1: # %block
33 store volatile ptr blockaddress(@test_blockaddress, %block), ptr @addr
34 %val = load volatile ptr, ptr @addr
35 indirectbr ptr %val, [label %block]