aboutsummaryrefslogtreecommitdiff
path: root/llvm/test
diff options
context:
space:
mode:
authorwanglei <wanglei@loongson.cn>2025-09-29 09:02:35 +0800
committerGitHub <noreply@github.com>2025-09-29 09:02:35 +0800
commitcac0635ee9e947b5f90130df2f471aa4b722e04b (patch)
tree025b0d5bddbea3ce3051ed723de9457808870566 /llvm/test
parent12f42e5ed9286711287e17ec35ea9bbdeb2aa92e (diff)
downloadllvm-main.zip
llvm-main.tar.gz
llvm-main.tar.bz2
[LoongArch] Add option for merge base offset passHEADmain
Add `loongarch-enable-merge-offset` option to allow disabling the `MergeBaseOffset` pass when using optimization. Reviewers: SixWeining, heiher Reviewed By: SixWeining, heiher Pull Request: https://github.com/llvm/llvm-project/pull/161063
Diffstat (limited to 'llvm/test')
-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
+}