1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 -mattr=+d --verify-machineinstrs < %s | FileCheck %s --check-prefix=LA32
3 ; RUN: llc --mtriple=loongarch64 -mattr=+d --verify-machineinstrs < %s | FileCheck %s --check-prefix=LA64
5 define i32 @m_offset_neg_2049(ptr %p) nounwind {
6 ; LA32-LABEL: m_offset_neg_2049:
8 ; LA32-NEXT: addi.w $a0, $a0, -2048
9 ; LA32-NEXT: addi.w $a0, $a0, -1
11 ; LA32-NEXT: ld.w $a0, $a0, 0
15 ; LA64-LABEL: m_offset_neg_2049:
17 ; LA64-NEXT: addi.d $a0, $a0, -2048
18 ; LA64-NEXT: addi.d $a0, $a0, -1
20 ; LA64-NEXT: ld.w $a0, $a0, 0
23 %1 = getelementptr inbounds i8, ptr %p, i32 -2049
24 %2 = call i32 asm "ld.w $0, $1", "=r,*m"(ptr elementtype(i32) %1)
28 define i32 @m_offset_neg_2048(ptr %p) nounwind {
29 ; LA32-LABEL: m_offset_neg_2048:
32 ; LA32-NEXT: ld.w $a0, $a0, -2048
36 ; LA64-LABEL: m_offset_neg_2048:
39 ; LA64-NEXT: ld.w $a0, $a0, -2048
42 %1 = getelementptr inbounds i8, ptr %p, i32 -2048
43 %2 = call i32 asm "ld.w $0, $1", "=r,*m"(ptr elementtype(i32) %1)
47 define i32 @m_offset_neg_1(ptr %p) nounwind {
48 ; LA32-LABEL: m_offset_neg_1:
51 ; LA32-NEXT: ld.w $a0, $a0, -1
55 ; LA64-LABEL: m_offset_neg_1:
58 ; LA64-NEXT: ld.w $a0, $a0, -1
61 %1 = getelementptr inbounds i8, ptr %p, i32 -1
62 %2 = call i32 asm "ld.w $0, $1", "=r,*m"(ptr elementtype(i32) %1)
66 define i32 @m_offset_0(ptr %p) nounwind {
67 ; LA32-LABEL: m_offset_0:
70 ; LA32-NEXT: ld.w $a0, $a0, 0
74 ; LA64-LABEL: m_offset_0:
77 ; LA64-NEXT: ld.w $a0, $a0, 0
80 %1 = call i32 asm "ld.w $0, $1", "=r,*m"(ptr elementtype(i32) %p)
84 define i32 @m_offset_1(ptr %p) nounwind {
85 ; LA32-LABEL: m_offset_1:
88 ; LA32-NEXT: ld.w $a0, $a0, 1
92 ; LA64-LABEL: m_offset_1:
95 ; LA64-NEXT: ld.w $a0, $a0, 1
98 %1 = getelementptr inbounds i8, ptr %p, i32 1
99 %2 = call i32 asm "ld.w $0, $1", "=r,*m"(ptr elementtype(i32) %1)
103 define i32 @m_offset_2047(ptr %p) nounwind {
104 ; LA32-LABEL: m_offset_2047:
107 ; LA32-NEXT: ld.w $a0, $a0, 2047
111 ; LA64-LABEL: m_offset_2047:
114 ; LA64-NEXT: ld.w $a0, $a0, 2047
117 %1 = getelementptr inbounds i8, ptr %p, i32 2047
118 %2 = call i32 asm "ld.w $0, $1", "=r,*m"(ptr elementtype(i32) %1)
122 define i32 @m_offset_2048(ptr %p) nounwind {
123 ; LA32-LABEL: m_offset_2048:
125 ; LA32-NEXT: addi.w $a0, $a0, 2047
126 ; LA32-NEXT: addi.w $a0, $a0, 1
128 ; LA32-NEXT: ld.w $a0, $a0, 0
132 ; LA64-LABEL: m_offset_2048:
134 ; LA64-NEXT: addi.d $a0, $a0, 2047
135 ; LA64-NEXT: addi.d $a0, $a0, 1
137 ; LA64-NEXT: ld.w $a0, $a0, 0
140 %1 = getelementptr inbounds i8, ptr %p, i32 2048
141 %2 = call i32 asm "ld.w $0, $1", "=r,*m"(ptr elementtype(i32) %1)