summaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/Mips/msa/ldr_str.ll
blob: 74f84aa9bbd7a616864e6ad6ad02559df4e7799a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -march=mips     -mcpu=mips32r5 -mattr=+msa,+fp64 -O0 < %s | FileCheck %s --check-prefix=MIPS32R5-EB
; RUN: llc -march=mipsel   -mcpu=mips32r5 -mattr=+msa,+fp64 -O0 < %s | FileCheck %s --check-prefix=MIPS32R5-EL
; RUN: llc -march=mips     -mcpu=mips32r6 -mattr=+msa,+fp64 -O0 < %s | FileCheck %s --check-prefix=MIPS32R6-EB
; RUN: llc -march=mipsel   -mcpu=mips32r6 -mattr=+msa,+fp64 -O0 < %s | FileCheck %s --check-prefix=MIPS32R6-EL
; RUN: llc -march=mips64   -mcpu=mips64r6 -mattr=+msa,+fp64 -O0 < %s | FileCheck %s --check-prefix=MIPS64R6
; RUN: llc -march=mips64el -mcpu=mips64r6 -mattr=+msa,+fp64 -O0 < %s | FileCheck %s --check-prefix=MIPS64R6

; Test intrinsics for 4-byte and 8-byte MSA load and stores.

define void @llvm_mips_ldr_d_test(ptr %val, ptr %ptr) nounwind {
; MIPS32R5-EB-LABEL: llvm_mips_ldr_d_test:
; MIPS32R5-EB:       # %bb.0: # %entry
; MIPS32R5-EB-NEXT:    # implicit-def: $v0
; MIPS32R5-EB-NEXT:    lwr $2, 23($5)
; MIPS32R5-EB-NEXT:    lwl $2, 20($5)
; MIPS32R5-EB-NEXT:    # implicit-def: $at
; MIPS32R5-EB-NEXT:    lwr $1, 19($5)
; MIPS32R5-EB-NEXT:    lwl $1, 16($5)
; MIPS32R5-EB-NEXT:    fill.w $w0, $2
; MIPS32R5-EB-NEXT:    insert.w $w0[1], $1
; MIPS32R5-EB-NEXT:    st.d $w0, 0($4)
; MIPS32R5-EB-NEXT:    jr $ra
; MIPS32R5-EB-NEXT:    nop
;
; MIPS32R5-EL-LABEL: llvm_mips_ldr_d_test:
; MIPS32R5-EL:       # %bb.0: # %entry
; MIPS32R5-EL-NEXT:    # implicit-def: $v0
; MIPS32R5-EL-NEXT:    lwr $2, 16($5)
; MIPS32R5-EL-NEXT:    lwl $2, 19($5)
; MIPS32R5-EL-NEXT:    # implicit-def: $at
; MIPS32R5-EL-NEXT:    lwr $1, 20($5)
; MIPS32R5-EL-NEXT:    lwl $1, 23($5)
; MIPS32R5-EL-NEXT:    fill.w $w0, $2
; MIPS32R5-EL-NEXT:    insert.w $w0[1], $1
; MIPS32R5-EL-NEXT:    st.d $w0, 0($4)
; MIPS32R5-EL-NEXT:    jr $ra
; MIPS32R5-EL-NEXT:    nop
;
; MIPS32R6-EB-LABEL: llvm_mips_ldr_d_test:
; MIPS32R6-EB:       # %bb.0: # %entry
; MIPS32R6-EB-NEXT:    lw $2, 20($5)
; MIPS32R6-EB-NEXT:    lw $1, 16($5)
; MIPS32R6-EB-NEXT:    fill.w $w0, $2
; MIPS32R6-EB-NEXT:    insert.w $w0[1], $1
; MIPS32R6-EB-NEXT:    st.d $w0, 0($4)
; MIPS32R6-EB-NEXT:    jrc $ra
;
; MIPS32R6-EL-LABEL: llvm_mips_ldr_d_test:
; MIPS32R6-EL:       # %bb.0: # %entry
; MIPS32R6-EL-NEXT:    lw $2, 16($5)
; MIPS32R6-EL-NEXT:    lw $1, 20($5)
; MIPS32R6-EL-NEXT:    fill.w $w0, $2
; MIPS32R6-EL-NEXT:    insert.w $w0[1], $1
; MIPS32R6-EL-NEXT:    st.d $w0, 0($4)
; MIPS32R6-EL-NEXT:    jrc $ra
;
; MIPS64R6-LABEL: llvm_mips_ldr_d_test:
; MIPS64R6:       # %bb.0: # %entry
; MIPS64R6-NEXT:    ld $1, 16($5)
; MIPS64R6-NEXT:    fill.d $w0, $1
; MIPS64R6-NEXT:    st.d $w0, 0($4)
; MIPS64R6-NEXT:    jrc $ra
entry:
  %0 = tail call <2 x i64> @llvm.mips.ldr.d(ptr %ptr, i32 16)
  store <2 x i64> %0, ptr %val
  ret void
}

declare <2 x i64> @llvm.mips.ldr.d(ptr, i32) nounwind

define void @llvm_mips_ldr_w_test(ptr %val, ptr %ptr) nounwind {
; MIPS32R5-EB-LABEL: llvm_mips_ldr_w_test:
; MIPS32R5-EB:       # %bb.0: # %entry
; MIPS32R5-EB-NEXT:    # implicit-def: $at
; MIPS32R5-EB-NEXT:    lwr $1, 19($5)
; MIPS32R5-EB-NEXT:    lwl $1, 16($5)
; MIPS32R5-EB-NEXT:    fill.w $w0, $1
; MIPS32R5-EB-NEXT:    st.w $w0, 0($4)
; MIPS32R5-EB-NEXT:    jr $ra
; MIPS32R5-EB-NEXT:    nop
;
; MIPS32R5-EL-LABEL: llvm_mips_ldr_w_test:
; MIPS32R5-EL:       # %bb.0: # %entry
; MIPS32R5-EL-NEXT:    # implicit-def: $at
; MIPS32R5-EL-NEXT:    lwr $1, 16($5)
; MIPS32R5-EL-NEXT:    lwl $1, 19($5)
; MIPS32R5-EL-NEXT:    fill.w $w0, $1
; MIPS32R5-EL-NEXT:    st.w $w0, 0($4)
; MIPS32R5-EL-NEXT:    jr $ra
; MIPS32R5-EL-NEXT:    nop
;
; MIPS32R6-EB-LABEL: llvm_mips_ldr_w_test:
; MIPS32R6-EB:       # %bb.0: # %entry
; MIPS32R6-EB-NEXT:    lw $1, 16($5)
; MIPS32R6-EB-NEXT:    fill.w $w0, $1
; MIPS32R6-EB-NEXT:    st.w $w0, 0($4)
; MIPS32R6-EB-NEXT:    jrc $ra
;
; MIPS32R6-EL-LABEL: llvm_mips_ldr_w_test:
; MIPS32R6-EL:       # %bb.0: # %entry
; MIPS32R6-EL-NEXT:    lw $1, 16($5)
; MIPS32R6-EL-NEXT:    fill.w $w0, $1
; MIPS32R6-EL-NEXT:    st.w $w0, 0($4)
; MIPS32R6-EL-NEXT:    jrc $ra
;
; MIPS64R6-LABEL: llvm_mips_ldr_w_test:
; MIPS64R6:       # %bb.0: # %entry
; MIPS64R6-NEXT:    lw $1, 16($5)
; MIPS64R6-NEXT:    fill.w $w0, $1
; MIPS64R6-NEXT:    st.w $w0, 0($4)
; MIPS64R6-NEXT:    jrc $ra
entry:
  %0 = tail call <4 x i32> @llvm.mips.ldr.w(ptr %ptr, i32 16)
  store <4 x i32> %0, ptr %val
  ret void
}

declare <4 x i32> @llvm.mips.ldr.w(ptr, i32) nounwind

define void @llvm_mips_str_d_test(ptr %val, ptr %ptr) nounwind {
; MIPS32R5-EB-LABEL: llvm_mips_str_d_test:
; MIPS32R5-EB:       # %bb.0: # %entry
; MIPS32R5-EB-NEXT:    ld.d $w0, 0($4)
; MIPS32R5-EB-NEXT:    copy_s.w $2, $w0[0]
; MIPS32R5-EB-NEXT:    copy_s.w $1, $w0[1]
; MIPS32R5-EB-NEXT:    swr $2, 19($5)
; MIPS32R5-EB-NEXT:    swl $2, 16($5)
; MIPS32R5-EB-NEXT:    swr $1, 23($5)
; MIPS32R5-EB-NEXT:    swl $1, 20($5)
; MIPS32R5-EB-NEXT:    jr $ra
; MIPS32R5-EB-NEXT:    nop
;
; MIPS32R5-EL-LABEL: llvm_mips_str_d_test:
; MIPS32R5-EL:       # %bb.0: # %entry
; MIPS32R5-EL-NEXT:    ld.d $w0, 0($4)
; MIPS32R5-EL-NEXT:    copy_s.w $2, $w0[0]
; MIPS32R5-EL-NEXT:    copy_s.w $1, $w0[1]
; MIPS32R5-EL-NEXT:    swr $2, 16($5)
; MIPS32R5-EL-NEXT:    swl $2, 19($5)
; MIPS32R5-EL-NEXT:    swr $1, 20($5)
; MIPS32R5-EL-NEXT:    swl $1, 23($5)
; MIPS32R5-EL-NEXT:    jr $ra
; MIPS32R5-EL-NEXT:    nop
;
; MIPS32R6-EB-LABEL: llvm_mips_str_d_test:
; MIPS32R6-EB:       # %bb.0: # %entry
; MIPS32R6-EB-NEXT:    ld.d $w0, 0($4)
; MIPS32R6-EB-NEXT:    copy_s.w $2, $w0[0]
; MIPS32R6-EB-NEXT:    copy_s.w $1, $w0[1]
; MIPS32R6-EB-NEXT:    sw $2, 20($5)
; MIPS32R6-EB-NEXT:    sw $1, 16($5)
; MIPS32R6-EB-NEXT:    jrc $ra
;
; MIPS32R6-EL-LABEL: llvm_mips_str_d_test:
; MIPS32R6-EL:       # %bb.0: # %entry
; MIPS32R6-EL-NEXT:    ld.d $w0, 0($4)
; MIPS32R6-EL-NEXT:    copy_s.w $2, $w0[0]
; MIPS32R6-EL-NEXT:    copy_s.w $1, $w0[1]
; MIPS32R6-EL-NEXT:    sw $2, 16($5)
; MIPS32R6-EL-NEXT:    sw $1, 20($5)
; MIPS32R6-EL-NEXT:    jrc $ra
;
; MIPS64R6-LABEL: llvm_mips_str_d_test:
; MIPS64R6:       # %bb.0: # %entry
; MIPS64R6-NEXT:    ld.d $w0, 0($4)
; MIPS64R6-NEXT:    copy_s.d $1, $w0[0]
; MIPS64R6-NEXT:    sd $1, 16($5)
; MIPS64R6-NEXT:    jrc $ra
entry:
  %0 = load <2 x i64>, ptr %val
  tail call void @llvm.mips.str.d(<2 x i64> %0, ptr %ptr, i32 16)
  ret void
}

declare void @llvm.mips.str.d(<2 x i64>, ptr, i32) nounwind

define void @llvm_mips_str_w_test(ptr %val, ptr %ptr) nounwind {
; MIPS32R5-EB-LABEL: llvm_mips_str_w_test:
; MIPS32R5-EB:       # %bb.0: # %entry
; MIPS32R5-EB-NEXT:    ld.w $w0, 0($4)
; MIPS32R5-EB-NEXT:    copy_s.w $1, $w0[0]
; MIPS32R5-EB-NEXT:    swr $1, 19($5)
; MIPS32R5-EB-NEXT:    swl $1, 16($5)
; MIPS32R5-EB-NEXT:    jr $ra
; MIPS32R5-EB-NEXT:    nop
;
; MIPS32R5-EL-LABEL: llvm_mips_str_w_test:
; MIPS32R5-EL:       # %bb.0: # %entry
; MIPS32R5-EL-NEXT:    ld.w $w0, 0($4)
; MIPS32R5-EL-NEXT:    copy_s.w $1, $w0[0]
; MIPS32R5-EL-NEXT:    swr $1, 16($5)
; MIPS32R5-EL-NEXT:    swl $1, 19($5)
; MIPS32R5-EL-NEXT:    jr $ra
; MIPS32R5-EL-NEXT:    nop
;
; MIPS32R6-EB-LABEL: llvm_mips_str_w_test:
; MIPS32R6-EB:       # %bb.0: # %entry
; MIPS32R6-EB-NEXT:    ld.w $w0, 0($4)
; MIPS32R6-EB-NEXT:    copy_s.w $1, $w0[0]
; MIPS32R6-EB-NEXT:    sw $1, 16($5)
; MIPS32R6-EB-NEXT:    jrc $ra
;
; MIPS32R6-EL-LABEL: llvm_mips_str_w_test:
; MIPS32R6-EL:       # %bb.0: # %entry
; MIPS32R6-EL-NEXT:    ld.w $w0, 0($4)
; MIPS32R6-EL-NEXT:    copy_s.w $1, $w0[0]
; MIPS32R6-EL-NEXT:    sw $1, 16($5)
; MIPS32R6-EL-NEXT:    jrc $ra
;
; MIPS64R6-LABEL: llvm_mips_str_w_test:
; MIPS64R6:       # %bb.0: # %entry
; MIPS64R6-NEXT:    ld.w $w0, 0($4)
; MIPS64R6-NEXT:    copy_s.w $1, $w0[0]
; MIPS64R6-NEXT:    sw $1, 16($5)
; MIPS64R6-NEXT:    jrc $ra
entry:
  %0 = load <4 x i32>, ptr %val
  tail call void @llvm.mips.str.w(<4 x i32> %0, ptr %ptr, i32 16)
  ret void
}

declare void @llvm.mips.str.w(<4 x i32>, ptr, i32) nounwind