aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/LoongArch/merge-offset-option.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/CodeGen/LoongArch/merge-offset-option.ll')
-rw-r--r--llvm/test/CodeGen/LoongArch/merge-offset-option.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/LoongArch/merge-offset-option.ll b/llvm/test/CodeGen/LoongArch/merge-offset-option.ll
new file mode 100644
index 0000000..e5351a6
--- /dev/null
+++ b/llvm/test/CodeGen/LoongArch/merge-offset-option.ll
@@ -0,0 +1,24 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc --mtriple=loongarch64 -mattr=+d --relocation-model=static -O1 \
+; RUN: < %s | FileCheck %s --check-prefix=MERGE
+; RUN: llc --mtriple=loongarch64 -mattr=+d --relocation-model=static -O1 \
+; RUN: --loongarch-enable-merge-offset=false < %s | FileCheck %s --check-prefix=NO_MERGE
+
+@g = dso_local global i32 zeroinitializer, align 4
+
+define void @foo() nounwind {
+; MERGE-LABEL: foo:
+; MERGE: # %bb.0:
+; MERGE-NEXT: pcalau12i $a0, %pc_hi20(g)
+; MERGE-NEXT: ld.w $zero, $a0, %pc_lo12(g)
+; MERGE-NEXT: ret
+;
+; NO_MERGE-LABEL: foo:
+; NO_MERGE: # %bb.0:
+; NO_MERGE-NEXT: pcalau12i $a0, %pc_hi20(g)
+; NO_MERGE-NEXT: addi.d $a0, $a0, %pc_lo12(g)
+; NO_MERGE-NEXT: ld.w $zero, $a0, 0
+; NO_MERGE-NEXT: ret
+ %v = load volatile i32, ptr @g
+ ret void
+}