[llvm] 84ad292 - [LoongArch] Pre-commit tests for merge base offset. NFC

WANG Rui via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 23:45:09 PDT 2024


Author: WANG Rui
Date: 2024-07-30T14:45:25+08:00
New Revision: 84ad292f343e0b0b821fc18447a20c59530f9ec7

URL: https://github.com/llvm/llvm-project/commit/84ad292f343e0b0b821fc18447a20c59530f9ec7
DIFF: https://github.com/llvm/llvm-project/commit/84ad292f343e0b0b821fc18447a20c59530f9ec7.diff

LOG: [LoongArch] Pre-commit tests for merge base offset. NFC

Added: 
    llvm/test/CodeGen/LoongArch/merge-base-offset.ll

Modified: 
    llvm/test/CodeGen/LoongArch/inline-asm-constraint-m.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/LoongArch/inline-asm-constraint-m.ll b/llvm/test/CodeGen/LoongArch/inline-asm-constraint-m.ll
index 281d52c47b685..becb3cae46b8c 100644
--- a/llvm/test/CodeGen/LoongArch/inline-asm-constraint-m.ll
+++ b/llvm/test/CodeGen/LoongArch/inline-asm-constraint-m.ll
@@ -141,3 +141,49 @@ define i32 @m_offset_2048(ptr %p) nounwind {
   %2 = call i32 asm "ld.w $0, $1", "=r,*m"(ptr elementtype(i32) %1)
   ret i32 %2
 }
+
+ at g_i32 = dso_local global i32 0
+
+define i32 @m_addr_pcrel() nounwind {
+; LA32-LABEL: m_addr_pcrel:
+; LA32:       # %bb.0:
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA32-NEXT:    addi.w $a1, $a0, %pc_lo12(g_i32)
+; LA32-NEXT:    #APP
+; LA32-NEXT:    ld.w $a0, $a1, 0
+; LA32-NEXT:    #NO_APP
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: m_addr_pcrel:
+; LA64:       # %bb.0:
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA64-NEXT:    addi.d $a1, $a0, %pc_lo12(g_i32)
+; LA64-NEXT:    #APP
+; LA64-NEXT:    ld.w $a0, $a1, 0
+; LA64-NEXT:    #NO_APP
+; LA64-NEXT:    ret
+  %1 = tail call i32 asm sideeffect "ld.w $0, $1", "=&r,*m"(ptr nonnull elementtype(i32) @g_i32)
+  ret i32 %1
+}
+
+define i32 @m_addr_should_not_fold() nounwind {
+; LA32-LABEL: m_addr_should_not_fold:
+; LA32:       # %bb.0:
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA32-NEXT:    addi.w $a1, $a0, %pc_lo12(g_i32)
+; LA32-NEXT:    #APP
+; LA32-NEXT:    ld.w $a0, $a1, 0
+; LA32-NEXT:    #NO_APP
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: m_addr_should_not_fold:
+; LA64:       # %bb.0:
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA64-NEXT:    addi.d $a1, $a0, %pc_lo12(g_i32)
+; LA64-NEXT:    #APP
+; LA64-NEXT:    ld.w $a0, $a1, 0
+; LA64-NEXT:    #NO_APP
+; LA64-NEXT:    ret
+  %1 = tail call i32 asm sideeffect "ld.w $0, $1, 0", "=&r,r,~{memory}"(ptr nonnull @g_i32)
+  ret i32 %1
+}

diff  --git a/llvm/test/CodeGen/LoongArch/merge-base-offset.ll b/llvm/test/CodeGen/LoongArch/merge-base-offset.ll
new file mode 100644
index 0000000000000..48d18dbedcaf2
--- /dev/null
+++ b/llvm/test/CodeGen/LoongArch/merge-base-offset.ll
@@ -0,0 +1,1107 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc --mtriple=loongarch32 --mattr=+d --verify-machineinstrs < %s \
+; RUN:   | FileCheck --check-prefix=LA32 %s
+; RUN: llc --mtriple=loongarch64 --mattr=+d --verify-machineinstrs < %s \
+; RUN:   | FileCheck --check-prefix=LA64 %s
+; RUN: llc --mtriple=loongarch64 --mattr=+d --verify-machineinstrs \
+; RUN:   --code-model=large < %s | FileCheck --check-prefix=LA64-LARGE %s
+
+ at g_i8 = dso_local global i8 0
+
+define dso_local signext i8 @load_s8() nounwind {
+; LA32-LABEL: load_s8:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i8)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_i8)
+; LA32-NEXT:    ld.b $a0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_s8:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i8)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i8)
+; LA64-NEXT:    ld.b $a0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_s8:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i8)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i8)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i8)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i8)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.b $a0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load i8, ptr @g_i8
+  ret i8 %0
+}
+
+define dso_local zeroext i8 @load_u8() nounwind {
+; LA32-LABEL: load_u8:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i8)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_i8)
+; LA32-NEXT:    ld.bu $a0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_u8:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i8)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i8)
+; LA64-NEXT:    ld.bu $a0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_u8:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i8)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i8)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i8)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i8)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.bu $a0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load i8, ptr @g_i8
+  ret i8 %0
+}
+
+define dso_local void @store_i8() nounwind {
+; LA32-LABEL: store_i8:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i8)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_i8)
+; LA32-NEXT:    ori $a1, $zero, 1
+; LA32-NEXT:    st.b $a1, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_i8:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i8)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i8)
+; LA64-NEXT:    ori $a1, $zero, 1
+; LA64-NEXT:    st.b $a1, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_i8:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i8)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i8)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i8)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i8)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ori $a1, $zero, 1
+; LA64-LARGE-NEXT:    st.b $a1, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  store i8 1, ptr @g_i8
+  ret void
+}
+
+ at g_i16 = dso_local global i16 0
+
+define dso_local signext i16 @load_s16() nounwind {
+; LA32-LABEL: load_s16:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i16)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_i16)
+; LA32-NEXT:    ld.h $a0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_s16:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i16)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i16)
+; LA64-NEXT:    ld.h $a0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_s16:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i16)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i16)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i16)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i16)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.h $a0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load i16, ptr @g_i16
+  ret i16 %0
+}
+
+define dso_local zeroext i16 @load_u16() nounwind {
+; LA32-LABEL: load_u16:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i16)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_i16)
+; LA32-NEXT:    ld.hu $a0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_u16:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i16)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i16)
+; LA64-NEXT:    ld.hu $a0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_u16:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i16)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i16)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i16)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i16)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.hu $a0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load i16, ptr @g_i16
+  ret i16 %0
+}
+
+define dso_local void @store_i16() nounwind {
+; LA32-LABEL: store_i16:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i16)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_i16)
+; LA32-NEXT:    ori $a1, $zero, 1
+; LA32-NEXT:    st.h $a1, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_i16:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i16)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i16)
+; LA64-NEXT:    ori $a1, $zero, 1
+; LA64-NEXT:    st.h $a1, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_i16:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i16)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i16)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i16)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i16)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ori $a1, $zero, 1
+; LA64-LARGE-NEXT:    st.h $a1, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  store i16 1, ptr @g_i16
+  ret void
+}
+
+ at g_i32 = dso_local global i32 0
+
+define dso_local signext i32 @load_s32() nounwind {
+; LA32-LABEL: load_s32:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_i32)
+; LA32-NEXT:    ld.w $a0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_s32:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i32)
+; LA64-NEXT:    ld.w $a0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_s32:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i32)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i32)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i32)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.w $a0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load i32, ptr @g_i32
+  ret i32 %0
+}
+
+define dso_local zeroext i32 @load_u32() nounwind {
+; LA32-LABEL: load_u32:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_i32)
+; LA32-NEXT:    ld.w $a0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_u32:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i32)
+; LA64-NEXT:    ld.wu $a0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_u32:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i32)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i32)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i32)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.wu $a0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load i32, ptr @g_i32
+  ret i32 %0
+}
+
+define dso_local void @store_i32() nounwind {
+; LA32-LABEL: store_i32:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_i32)
+; LA32-NEXT:    ori $a1, $zero, 1
+; LA32-NEXT:    st.w $a1, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_i32:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i32)
+; LA64-NEXT:    ori $a1, $zero, 1
+; LA64-NEXT:    st.w $a1, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_i32:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i32)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i32)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i32)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i32)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ori $a1, $zero, 1
+; LA64-LARGE-NEXT:    st.w $a1, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  store i32 1, ptr @g_i32
+  ret void
+}
+
+ at g_i64 = dso_local global i64 0
+
+define dso_local i64 @load_64() nounwind {
+; LA32-LABEL: load_64:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i64)
+; LA32-NEXT:    addi.w $a1, $a0, %pc_lo12(g_i64)
+; LA32-NEXT:    ld.w $a0, $a1, 0
+; LA32-NEXT:    ld.w $a1, $a1, 4
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_64:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i64)
+; LA64-NEXT:    ld.d $a0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_64:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.d $a0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load i64, ptr @g_i64
+  ret i64 %0
+}
+
+define dso_local void @store_i64() nounwind {
+; LA32-LABEL: store_i64:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_i64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_i64)
+; LA32-NEXT:    st.w $zero, $a0, 4
+; LA32-NEXT:    ori $a1, $zero, 1
+; LA32-NEXT:    st.w $a1, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_i64:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_i64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_i64)
+; LA64-NEXT:    ori $a1, $zero, 1
+; LA64-NEXT:    st.d $a1, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_i64:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_i64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_i64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_i64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_i64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ori $a1, $zero, 1
+; LA64-LARGE-NEXT:    st.d $a1, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  store i64 1, ptr @g_i64
+  ret void
+}
+
+ at g_f32 = dso_local global float 0.0
+
+define dso_local float @load_f32() nounwind {
+; LA32-LABEL: load_f32:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_f32)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_f32)
+; LA32-NEXT:    fld.s $fa0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_f32:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_f32)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_f32)
+; LA64-NEXT:    fld.s $fa0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_f32:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_f32)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_f32)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_f32)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_f32)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    fld.s $fa0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load float, ptr @g_f32
+  ret float %0
+}
+
+define dso_local void @store_f32() nounwind {
+; LA32-LABEL: store_f32:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_f32)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_f32)
+; LA32-NEXT:    lu12i.w $a1, 260096
+; LA32-NEXT:    st.w $a1, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_f32:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_f32)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_f32)
+; LA64-NEXT:    lu12i.w $a1, 260096
+; LA64-NEXT:    st.w $a1, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_f32:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_f32)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_f32)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_f32)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_f32)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    lu12i.w $a1, 260096
+; LA64-LARGE-NEXT:    st.w $a1, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  store float 1.0, ptr @g_f32
+  ret void
+}
+
+ at g_f64 = dso_local global double 0.0
+
+define dso_local double @load_f64() nounwind {
+; LA32-LABEL: load_f64:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_f64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_f64)
+; LA32-NEXT:    fld.d $fa0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_f64:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_f64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_f64)
+; LA64-NEXT:    fld.d $fa0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_f64:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_f64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_f64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_f64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_f64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    fld.d $fa0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load double, ptr @g_f64
+  ret double %0
+}
+
+define dso_local void @store_f64() nounwind {
+; LA32-LABEL: store_f64:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_f64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_f64)
+; LA32-NEXT:    addi.w $a1, $zero, 1
+; LA32-NEXT:    movgr2fr.w $fa0, $a1
+; LA32-NEXT:    ffint.s.w $fa0, $fa0
+; LA32-NEXT:    fcvt.d.s $fa0, $fa0
+; LA32-NEXT:    fst.d $fa0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_f64:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_f64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_f64)
+; LA64-NEXT:    lu52i.d $a1, $zero, 1023
+; LA64-NEXT:    st.d $a1, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_f64:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_f64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_f64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_f64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_f64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    lu52i.d $a1, $zero, 1023
+; LA64-LARGE-NEXT:    st.d $a1, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  store double 1.0, ptr @g_f64
+  ret void
+}
+
+ at g_m64 = dso_local global i64 0
+
+define dso_local void @store_multi() nounwind {
+; LA32-LABEL: store_multi:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_m64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_m64)
+; LA32-NEXT:    st.w $zero, $a0, 4
+; LA32-NEXT:    ori $a1, $zero, 1
+; LA32-NEXT:    st.w $a1, $a0, 0
+; LA32-NEXT:    st.w $zero, $a0, 4
+; LA32-NEXT:    ori $a1, $zero, 2
+; LA32-NEXT:    st.w $a1, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_multi:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_m64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_m64)
+; LA64-NEXT:    ori $a1, $zero, 1
+; LA64-NEXT:    st.d $a1, $a0, 0
+; LA64-NEXT:    ori $a1, $zero, 2
+; LA64-NEXT:    st.d $a1, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_multi:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_m64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_m64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_m64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_m64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ori $a1, $zero, 1
+; LA64-LARGE-NEXT:    st.d $a1, $a0, 0
+; LA64-LARGE-NEXT:    ori $a1, $zero, 2
+; LA64-LARGE-NEXT:    st.d $a1, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  store volatile i64 1, ptr @g_m64
+  store volatile i64 2, ptr @g_m64
+  ret void
+}
+
+ at g_sf32 = dso_local global float 0.0
+
+define dso_local void @store_sf32() nounwind {
+; LA32-LABEL: store_sf32:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_sf32)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_sf32)
+; LA32-NEXT:    fld.s $fa0, $a0, 0
+; LA32-NEXT:    fst.s $fa0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_sf32:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_sf32)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_sf32)
+; LA64-NEXT:    fld.s $fa0, $a0, 0
+; LA64-NEXT:    fst.s $fa0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_sf32:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_sf32)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_sf32)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_sf32)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_sf32)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    fld.s $fa0, $a0, 0
+; LA64-LARGE-NEXT:    fst.s $fa0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load float, ptr @g_sf32
+  store volatile float %0, ptr @g_sf32
+  ret void
+}
+
+ at g_sf64 = dso_local global double 0.0
+
+define dso_local void @store_sf64() nounwind {
+; LA32-LABEL: store_sf64:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_sf64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_sf64)
+; LA32-NEXT:    fld.d $fa0, $a0, 0
+; LA32-NEXT:    fst.d $fa0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_sf64:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_sf64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_sf64)
+; LA64-NEXT:    fld.d $fa0, $a0, 0
+; LA64-NEXT:    fst.d $fa0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_sf64:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_sf64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_sf64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_sf64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_sf64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    fld.d $fa0, $a0, 0
+; LA64-LARGE-NEXT:    fst.d $fa0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load double, ptr @g_sf64
+  store volatile double %0, ptr @g_sf64
+  ret void
+}
+
+ at g_rmw = dso_local global i64 0
+
+define dso_local void @rmw() nounwind {
+; LA32-LABEL: rmw:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_rmw)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_rmw)
+; LA32-NEXT:    ld.w $a1, $a0, 0
+; LA32-NEXT:    ld.w $a2, $a0, 4
+; LA32-NEXT:    addi.w $a1, $a1, 1
+; LA32-NEXT:    sltui $a3, $a1, 1
+; LA32-NEXT:    add.w $a2, $a2, $a3
+; LA32-NEXT:    st.w $a1, $a0, 0
+; LA32-NEXT:    st.w $a2, $a0, 4
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: rmw:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_rmw)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_rmw)
+; LA64-NEXT:    ld.d $a1, $a0, 0
+; LA64-NEXT:    addi.d $a1, $a1, 1
+; LA64-NEXT:    st.d $a1, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: rmw:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_rmw)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_rmw)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_rmw)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_rmw)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.d $a1, $a0, 0
+; LA64-LARGE-NEXT:    addi.d $a1, $a1, 1
+; LA64-LARGE-NEXT:    st.d $a1, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load i64, ptr @g_rmw
+  %1 = add i64 %0, 1
+  store i64 %1, ptr @g_rmw
+  ret void
+}
+
+ at g_a32 = dso_local global [2048 x i32] zeroinitializer, align 4
+
+define dso_local void @store_a32() nounwind {
+; LA32-LABEL: store_a32:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a32)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a32)
+; LA32-NEXT:    lu12i.w $a1, 1
+; LA32-NEXT:    add.w $a0, $a0, $a1
+; LA32-NEXT:    ori $a1, $zero, 1
+; LA32-NEXT:    st.w $a1, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_a32:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a32)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a32)
+; LA64-NEXT:    ori $a1, $zero, 1
+; LA64-NEXT:    stptr.w $a1, $a0, 4096
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_a32:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a32)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a32)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a32)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a32)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ori $a1, $zero, 1
+; LA64-LARGE-NEXT:    stptr.w $a1, $a0, 4096
+; LA64-LARGE-NEXT:    ret
+entry:
+  store i32 1, ptr getelementptr inbounds ([1 x i32], ptr @g_a32, i32 1024), align 4
+  ret void
+}
+
+define dso_local void @store_a32_2() nounwind {
+; LA32-LABEL: store_a32_2:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a32)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a32)
+; LA32-NEXT:    lu12i.w $a1, 1
+; LA32-NEXT:    add.w $a2, $a0, $a1
+; LA32-NEXT:    ori $a3, $zero, 1
+; LA32-NEXT:    st.w $a3, $a2, 0
+; LA32-NEXT:    ori $a1, $a1, 8
+; LA32-NEXT:    add.w $a0, $a0, $a1
+; LA32-NEXT:    ori $a1, $zero, 2
+; LA32-NEXT:    st.w $a1, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: store_a32_2:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a32)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a32)
+; LA64-NEXT:    ori $a1, $zero, 1
+; LA64-NEXT:    stptr.w $a1, $a0, 4096
+; LA64-NEXT:    ori $a1, $zero, 2
+; LA64-NEXT:    stptr.w $a1, $a0, 4104
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: store_a32_2:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a32)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a32)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a32)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a32)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ori $a1, $zero, 1
+; LA64-LARGE-NEXT:    stptr.w $a1, $a0, 4096
+; LA64-LARGE-NEXT:    ori $a1, $zero, 2
+; LA64-LARGE-NEXT:    stptr.w $a1, $a0, 4104
+; LA64-LARGE-NEXT:    ret
+entry:
+  store i32 1, ptr getelementptr inbounds ([1 x i32], ptr @g_a32, i32 1024), align 4
+  store i32 2, ptr getelementptr inbounds ([1 x i32], ptr @g_a32, i32 1026), align 4
+  ret void
+}
+
+define dso_local void @control_flow_with_mem_access() nounwind {
+; LA32-LABEL: control_flow_with_mem_access:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a32)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a32)
+; LA32-NEXT:    ld.w $a1, $a0, 4
+; LA32-NEXT:    ori $a2, $zero, 1
+; LA32-NEXT:    blt $a1, $a2, .LBB21_2
+; LA32-NEXT:  # %bb.1: # %if.then
+; LA32-NEXT:    ori $a1, $zero, 10
+; LA32-NEXT:    st.w $a1, $a0, 4
+; LA32-NEXT:  .LBB21_2: # %if.end
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: control_flow_with_mem_access:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a32)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a32)
+; LA64-NEXT:    ld.w $a1, $a0, 4
+; LA64-NEXT:    ori $a2, $zero, 1
+; LA64-NEXT:    blt $a1, $a2, .LBB21_2
+; LA64-NEXT:  # %bb.1: # %if.then
+; LA64-NEXT:    ori $a1, $zero, 10
+; LA64-NEXT:    st.w $a1, $a0, 4
+; LA64-NEXT:  .LBB21_2: # %if.end
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: control_flow_with_mem_access:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a32)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a32)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a32)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a32)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.w $a0, $a0, 4
+; LA64-LARGE-NEXT:    ori $a1, $zero, 1
+; LA64-LARGE-NEXT:    blt $a0, $a1, .LBB21_2
+; LA64-LARGE-NEXT:  # %bb.1: # %if.then
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a32)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a32)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a32)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a32)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ori $a1, $zero, 10
+; LA64-LARGE-NEXT:    st.w $a1, $a0, 4
+; LA64-LARGE-NEXT:  .LBB21_2: # %if.end
+; LA64-LARGE-NEXT:    ret
+entry:
+  %0 = load i32, ptr getelementptr inbounds ([1 x i32], ptr @g_a32, i32 1), align 4
+  %cmp = icmp sgt i32 %0, 0
+  br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+  store i32 10, ptr getelementptr inbounds ([1 x i32], ptr @g_a32, i32 1), align 4
+  br label %if.end
+
+if.end:
+  ret void
+}
+
+define dso_local ptr @load_ba_1() nounwind {
+; LA32-LABEL: load_ba_1:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:  .Ltmp0: # Block address taken
+; LA32-NEXT:  # %bb.1: # %label
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.Ltmp0)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.Ltmp0)
+; LA32-NEXT:    ld.w $a0, $a0, 0
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_ba_1:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:  .Ltmp0: # Block address taken
+; LA64-NEXT:  # %bb.1: # %label
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.Ltmp0)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.Ltmp0)
+; LA64-NEXT:    ld.d $a0, $a0, 0
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_ba_1:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:  .Ltmp0: # Block address taken
+; LA64-LARGE-NEXT:  # %bb.1: # %label
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(.Ltmp0)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(.Ltmp0)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(.Ltmp0)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(.Ltmp0)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.d $a0, $a0, 0
+; LA64-LARGE-NEXT:    ret
+entry:
+  br label %label
+label:
+  %0 = load ptr, ptr blockaddress(@load_ba_1, %label)
+  ret ptr %0
+}
+
+define dso_local ptr @load_ba_2() nounwind {
+; LA32-LABEL: load_ba_2:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:  .Ltmp1: # Block address taken
+; LA32-NEXT:  # %bb.1: # %label
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.Ltmp1)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.Ltmp1)
+; LA32-NEXT:    ld.w $a0, $a0, 8
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_ba_2:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:  .Ltmp1: # Block address taken
+; LA64-NEXT:  # %bb.1: # %label
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.Ltmp1)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.Ltmp1)
+; LA64-NEXT:    ld.d $a0, $a0, 8
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_ba_2:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:  .Ltmp1: # Block address taken
+; LA64-LARGE-NEXT:  # %bb.1: # %label
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(.Ltmp1)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(.Ltmp1)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(.Ltmp1)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(.Ltmp1)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    ld.d $a0, $a0, 8
+; LA64-LARGE-NEXT:    ret
+entry:
+  br label %label
+label:
+  %0 = load ptr, ptr getelementptr inbounds (i8, ptr blockaddress(@load_ba_2, %label), i32 8)
+  ret ptr %0
+}
+
+ at g_a64 = dso_local global [614750729487779976 x i64] zeroinitializer, align 8
+
+define dso_local ptr @load_addr_offset_1() nounwind {
+; LA32-LABEL: load_addr_offset_1:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a64)
+; LA32-NEXT:    addi.w $a0, $a0, 8
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_addr_offset_1:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a64)
+; LA64-NEXT:    addi.d $a0, $a0, 8
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_addr_offset_1:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    addi.d $a0, $a0, 8
+; LA64-LARGE-NEXT:    ret
+entry:
+  ret ptr getelementptr inbounds ([1 x i64], ptr @g_a64, i64 1)
+}
+
+define dso_local ptr @load_addr_offset_257() nounwind {
+; LA32-LABEL: load_addr_offset_257:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a64)
+; LA32-NEXT:    addi.w $a0, $a0, 2047
+; LA32-NEXT:    addi.w $a0, $a0, 9
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_addr_offset_257:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a64)
+; LA64-NEXT:    addi.d $a0, $a0, 2047
+; LA64-NEXT:    addi.d $a0, $a0, 9
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_addr_offset_257:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    addi.d $a0, $a0, 2047
+; LA64-LARGE-NEXT:    addi.d $a0, $a0, 9
+; LA64-LARGE-NEXT:    ret
+entry:
+  ret ptr getelementptr inbounds ([1 x i64], ptr @g_a64, i64 257)
+}
+
+define dso_local ptr @load_addr_offset_1048576() nounwind {
+; LA32-LABEL: load_addr_offset_1048576:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a64)
+; LA32-NEXT:    lu12i.w $a1, 2048
+; LA32-NEXT:    add.w $a0, $a0, $a1
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_addr_offset_1048576:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a64)
+; LA64-NEXT:    addu16i.d $a0, $a0, 128
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_addr_offset_1048576:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    addu16i.d $a0, $a0, 128
+; LA64-LARGE-NEXT:    ret
+entry:
+  ret ptr getelementptr inbounds ([1 x i64], ptr @g_a64, i64 1048576)
+}
+
+define dso_local ptr @load_addr_offset_1048577() nounwind {
+; LA32-LABEL: load_addr_offset_1048577:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a64)
+; LA32-NEXT:    lu12i.w $a1, 2048
+; LA32-NEXT:    ori $a1, $a1, 8
+; LA32-NEXT:    add.w $a0, $a0, $a1
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_addr_offset_1048577:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a64)
+; LA64-NEXT:    addu16i.d $a0, $a0, 128
+; LA64-NEXT:    addi.d $a0, $a0, 8
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_addr_offset_1048577:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    addu16i.d $a0, $a0, 128
+; LA64-LARGE-NEXT:    addi.d $a0, $a0, 8
+; LA64-LARGE-NEXT:    ret
+entry:
+  ret ptr getelementptr inbounds ([1 x i64], ptr @g_a64, i64 1048577)
+}
+
+define dso_local ptr @load_addr_offset_268432896() nounwind {
+; LA32-LABEL: load_addr_offset_268432896:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a64)
+; LA32-NEXT:    lu12i.w $a1, 524283
+; LA32-NEXT:    add.w $a0, $a0, $a1
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_addr_offset_268432896:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a64)
+; LA64-NEXT:    lu12i.w $a1, 524283
+; LA64-NEXT:    add.d $a0, $a0, $a1
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_addr_offset_268432896:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    lu12i.w $a1, 524283
+; LA64-LARGE-NEXT:    add.d $a0, $a0, $a1
+; LA64-LARGE-NEXT:    ret
+entry:
+  ret ptr getelementptr inbounds ([1 x i64], ptr @g_a64, i64 268432896)
+}
+
+define dso_local ptr @load_addr_offset_268432897() nounwind {
+; LA32-LABEL: load_addr_offset_268432897:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a64)
+; LA32-NEXT:    lu12i.w $a1, 524283
+; LA32-NEXT:    ori $a1, $a1, 8
+; LA32-NEXT:    add.w $a0, $a0, $a1
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_addr_offset_268432897:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a64)
+; LA64-NEXT:    lu12i.w $a1, 524283
+; LA64-NEXT:    ori $a1, $a1, 8
+; LA64-NEXT:    add.d $a0, $a0, $a1
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_addr_offset_268432897:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    lu12i.w $a1, 524283
+; LA64-LARGE-NEXT:    ori $a1, $a1, 8
+; LA64-LARGE-NEXT:    add.d $a0, $a0, $a1
+; LA64-LARGE-NEXT:    ret
+entry:
+  ret ptr getelementptr inbounds ([1 x i64], ptr @g_a64, i64 268432897)
+}
+
+define dso_local ptr @load_addr_offset_9380351707272() nounwind {
+; LA32-LABEL: load_addr_offset_9380351707272:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a64)
+; LA32-NEXT:    lu12i.w $a1, 279556
+; LA32-NEXT:    ori $a1, $a1, 1088
+; LA32-NEXT:    add.w $a0, $a0, $a1
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_addr_offset_9380351707272:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a64)
+; LA64-NEXT:    lu12i.w $a1, 279556
+; LA64-NEXT:    ori $a1, $a1, 1088
+; LA64-NEXT:    lu32i.d $a1, 17472
+; LA64-NEXT:    add.d $a0, $a0, $a1
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_addr_offset_9380351707272:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    lu12i.w $a1, 279556
+; LA64-LARGE-NEXT:    ori $a1, $a1, 1088
+; LA64-LARGE-NEXT:    lu32i.d $a1, 17472
+; LA64-LARGE-NEXT:    add.d $a0, $a0, $a1
+; LA64-LARGE-NEXT:    ret
+entry:
+  ret ptr getelementptr inbounds ([1 x i64], ptr @g_a64, i64 9380351707272)
+}
+
+define dso_local ptr @load_addr_offset_614750729487779976() nounwind {
+; LA32-LABEL: load_addr_offset_614750729487779976:
+; LA32:       # %bb.0: # %entry
+; LA32-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(g_a64)
+; LA32-NEXT:    lu12i.w $a1, 279556
+; LA32-NEXT:    ori $a1, $a1, 1088
+; LA32-NEXT:    add.w $a0, $a0, $a1
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: load_addr_offset_614750729487779976:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(g_a64)
+; LA64-NEXT:    lu12i.w $a1, 279556
+; LA64-NEXT:    ori $a1, $a1, 1088
+; LA64-NEXT:    lu32i.d $a1, 17472
+; LA64-NEXT:    lu52i.d $a1, $a1, 1092
+; LA64-NEXT:    add.d $a0, $a0, $a1
+; LA64-NEXT:    ret
+;
+; LA64-LARGE-LABEL: load_addr_offset_614750729487779976:
+; LA64-LARGE:       # %bb.0: # %entry
+; LA64-LARGE-NEXT:    pcalau12i $a0, %pc_hi20(g_a64)
+; LA64-LARGE-NEXT:    addi.d $a1, $zero, %pc_lo12(g_a64)
+; LA64-LARGE-NEXT:    lu32i.d $a1, %pc64_lo20(g_a64)
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, %pc64_hi12(g_a64)
+; LA64-LARGE-NEXT:    add.d $a0, $a1, $a0
+; LA64-LARGE-NEXT:    lu12i.w $a1, 279556
+; LA64-LARGE-NEXT:    ori $a1, $a1, 1088
+; LA64-LARGE-NEXT:    lu32i.d $a1, 17472
+; LA64-LARGE-NEXT:    lu52i.d $a1, $a1, 1092
+; LA64-LARGE-NEXT:    add.d $a0, $a0, $a1
+; LA64-LARGE-NEXT:    ret
+entry:
+  ret ptr getelementptr inbounds ([1 x i64], ptr @g_a64, i64 614750729487779976)
+}


        


More information about the llvm-commits mailing list