[llvm] 445db93 - [LoongArch][NFC] Pre-commit tests for codegen with alias analysis

WANG Rui via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 04:54:01 PST 2024


Author: WANG Rui
Date: 2024-11-05T20:53:38+08:00
New Revision: 445db93844cb50eeb6f587bef0749c2950b46e70

URL: https://github.com/llvm/llvm-project/commit/445db93844cb50eeb6f587bef0749c2950b46e70
DIFF: https://github.com/llvm/llvm-project/commit/445db93844cb50eeb6f587bef0749c2950b46e70.diff

LOG: [LoongArch][NFC] Pre-commit tests for codegen with alias analysis

Added: 
    llvm/test/CodeGen/LoongArch/merge-load-store.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/LoongArch/merge-load-store.ll b/llvm/test/CodeGen/LoongArch/merge-load-store.ll
new file mode 100644
index 00000000000000..2eac65ebb1488d
--- /dev/null
+++ b/llvm/test/CodeGen/LoongArch/merge-load-store.ll
@@ -0,0 +1,79 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc --mtriple=loongarch32 --verify-machineinstrs < %s \
+; RUN:   | FileCheck --check-prefix=LA32 %s
+; RUN: llc --mtriple=loongarch64 --verify-machineinstrs < %s \
+; RUN:   | FileCheck --check-prefix=LA64 %s
+
+define void @merge_load_store(ptr noalias nocapture noundef readonly align 1 dereferenceable(8) %src, ptr noalias nocapture noundef writeonly align 1 dereferenceable(8) %dst) unnamed_addr {
+; LA32-LABEL: merge_load_store:
+; LA32:       # %bb.0: # %start
+; LA32-NEXT:    ld.b $a2, $a0, 0
+; LA32-NEXT:    ld.b $a3, $a0, 1
+; LA32-NEXT:    ld.b $a4, $a0, 2
+; LA32-NEXT:    ld.b $a5, $a0, 3
+; LA32-NEXT:    st.b $a2, $a1, 0
+; LA32-NEXT:    st.b $a3, $a1, 1
+; LA32-NEXT:    st.b $a4, $a1, 2
+; LA32-NEXT:    st.b $a5, $a1, 3
+; LA32-NEXT:    ld.b $a2, $a0, 4
+; LA32-NEXT:    ld.b $a3, $a0, 5
+; LA32-NEXT:    ld.b $a4, $a0, 6
+; LA32-NEXT:    ld.b $a0, $a0, 7
+; LA32-NEXT:    st.b $a2, $a1, 4
+; LA32-NEXT:    st.b $a3, $a1, 5
+; LA32-NEXT:    st.b $a4, $a1, 6
+; LA32-NEXT:    st.b $a0, $a1, 7
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: merge_load_store:
+; LA64:       # %bb.0: # %start
+; LA64-NEXT:    ld.b $a2, $a0, 0
+; LA64-NEXT:    ld.b $a3, $a0, 1
+; LA64-NEXT:    ld.b $a4, $a0, 2
+; LA64-NEXT:    ld.b $a5, $a0, 3
+; LA64-NEXT:    st.b $a2, $a1, 0
+; LA64-NEXT:    st.b $a3, $a1, 1
+; LA64-NEXT:    st.b $a4, $a1, 2
+; LA64-NEXT:    st.b $a5, $a1, 3
+; LA64-NEXT:    ld.b $a2, $a0, 4
+; LA64-NEXT:    ld.b $a3, $a0, 5
+; LA64-NEXT:    ld.b $a4, $a0, 6
+; LA64-NEXT:    ld.b $a0, $a0, 7
+; LA64-NEXT:    st.b $a2, $a1, 4
+; LA64-NEXT:    st.b $a3, $a1, 5
+; LA64-NEXT:    st.b $a4, $a1, 6
+; LA64-NEXT:    st.b $a0, $a1, 7
+; LA64-NEXT:    ret
+start:
+  %_3 = load i8, ptr %src, align 1
+  store i8 %_3, ptr %dst, align 1
+  %0 = getelementptr inbounds i8, ptr %src, i64 1
+  %_4 = load i8, ptr %0, align 1
+  %1 = getelementptr inbounds i8, ptr %dst, i64 1
+  store i8 %_4, ptr %1, align 1
+  %2 = getelementptr inbounds i8, ptr %src, i64 2
+  %_5 = load i8, ptr %2, align 1
+  %3 = getelementptr inbounds i8, ptr %dst, i64 2
+  store i8 %_5, ptr %3, align 1
+  %4 = getelementptr inbounds i8, ptr %src, i64 3
+  %_6 = load i8, ptr %4, align 1
+  %5 = getelementptr inbounds i8, ptr %dst, i64 3
+  store i8 %_6, ptr %5, align 1
+  %6 = getelementptr inbounds i8, ptr %src, i64 4
+  %_7 = load i8, ptr %6, align 1
+  %7 = getelementptr inbounds i8, ptr %dst, i64 4
+  store i8 %_7, ptr %7, align 1
+  %8 = getelementptr inbounds i8, ptr %src, i64 5
+  %_8 = load i8, ptr %8, align 1
+  %9 = getelementptr inbounds i8, ptr %dst, i64 5
+  store i8 %_8, ptr %9, align 1
+  %10 = getelementptr inbounds i8, ptr %src, i64 6
+  %_9 = load i8, ptr %10, align 1
+  %11 = getelementptr inbounds i8, ptr %dst, i64 6
+  store i8 %_9, ptr %11, align 1
+  %12 = getelementptr inbounds i8, ptr %src, i64 7
+  %_10 = load i8, ptr %12, align 1
+  %13 = getelementptr inbounds i8, ptr %dst, i64 7
+  store i8 %_10, ptr %13, align 1
+  ret void
+}


        


More information about the llvm-commits mailing list