1 ; Test whether the following functions, with vectors featuring negative or values larger than the element
2 ; bit size have their results of operations generated correctly when placed into constant pools
4 ; RUN: llc -march=mips64 -mattr=+msa,+fp64 -relocation-model=pic < %s \
5 ; RUN: | FileCheck -check-prefixes=ALL,MIPS64 %s
6 ; RUN: llc -march=mips -mattr=+msa,+fp64,+mips32r2 -relocation-model=pic < %s \
7 ; RUN: | FileCheck -check-prefixes=ALL,MIPS32 %s
8 ; RUN: llc -march=mips64el -mattr=+msa,+fp64 -relocation-model=pic < %s \
9 ; RUN: | FileCheck -check-prefixes=ALL,MIPS64 %s
10 ; RUN: llc -march=mipsel -mattr=+msa,+fp64,mips32r2 -relocation-model=pic < %s \
11 ; RUN: | FileCheck -check-prefixes=ALL,MIPS32 %s
13 @llvm_mips_bclr_w_test_const_vec_res = global <4 x i32> zeroinitializer, align 16
15 define void @llvm_mips_bclr_w_test_const_vec() nounwind {
17 %0 = tail call <4 x i32> @llvm.mips.bclr.w(<4 x i32> <i32 2147483649, i32 2147483649, i32 7, i32 7>, <4 x i32> <i32 -1, i32 31, i32 2, i32 34>)
18 store <4 x i32> %0, <4 x i32>* @llvm_mips_bclr_w_test_const_vec_res
22 declare <4 x i32> @llvm.mips.bclr.w(<4 x i32>, <4 x i32>) nounwind
24 ; MIPS32: [[LABEL:\$CPI[0-9]+_[0-9]+]]:
25 ; MIPS64: [[LABEL:\.LCPI[0-9]+_[0-9]+]]:
30 ; ALL-LABEL: llvm_mips_bclr_w_test_const_vec:
31 ; MIPS32: lw $[[R2:[0-9]+]], %got([[LABEL]])($[[R1:[0-9]+]])
32 ; MIPS32: addiu $[[R2]], $[[R2]], %lo([[LABEL]])
33 ; MIPS32: lw $[[R3:[0-9]+]], %got(llvm_mips_bclr_w_test_const_vec_res)($[[R1]])
34 ; MIPS64: ld $[[R2:[0-9]+]], %got_page([[LABEL]])($[[R1:[0-9]+]])
35 ; MIPS64: daddiu $[[R2]], $[[R2]], %got_ofst([[LABEL]])
36 ; MIPS64: ld $[[R3:[0-9]+]], %got_disp(llvm_mips_bclr_w_test_const_vec_res)($[[R1]])
37 ; ALL: ld.w $w0, 0($[[R2]])
38 ; ALL: st.w $w0, 0($[[R3]])
41 @llvm_mips_bneg_w_test_const_vec_res = global <4 x i32> zeroinitializer, align 16
43 define void @llvm_mips_bneg_w_test_const_vec() nounwind {
45 %0 = tail call <4 x i32> @llvm.mips.bneg.w(<4 x i32> <i32 2147483649, i32 2147483649, i32 7, i32 7>, <4 x i32> <i32 -1, i32 31, i32 2, i32 34>)
46 store <4 x i32> %0, <4 x i32>* @llvm_mips_bneg_w_test_const_vec_res
50 declare <4 x i32> @llvm.mips.bneg.w(<4 x i32>, <4 x i32>) nounwind
52 ; MIPS32: [[LABEL:\$CPI[0-9]+_[0-9]+]]:
53 ; MIPS64: [[LABEL:\.LCPI[0-9]+_[0-9]+]]:
58 ; ALL-LABEL: llvm_mips_bneg_w_test_const_vec:
59 ; MIPS32: lw $[[R2:[0-9]+]], %got([[LABEL]])($[[R1:[0-9]+]])
60 ; MIPS32: addiu $[[R2]], $[[R2]], %lo([[LABEL]])
61 ; MIPS32: lw $[[R3:[0-9]+]], %got(llvm_mips_bneg_w_test_const_vec_res)($[[R1]])
62 ; MIPS64: ld $[[R2:[0-9]+]], %got_page([[LABEL]])($[[R1:[0-9]+]])
63 ; MIPS64: daddiu $[[R2]], $[[R2]], %got_ofst([[LABEL]])
64 ; MIPS64: ld $[[R3:[0-9]+]], %got_disp(llvm_mips_bneg_w_test_const_vec_res)($[[R1]])
65 ; ALL: ld.w $w0, 0($[[R2]])
66 ; ALL: st.w $w0, 0($[[R3]])
69 @llvm_mips_bset_w_test_const_vec_res = global <4 x i32> zeroinitializer, align 16
71 define void @llvm_mips_bset_w_test_const_vec() nounwind {
73 %0 = tail call <4 x i32> @llvm.mips.bset.w(<4 x i32> <i32 0, i32 0, i32 0, i32 0>, <4 x i32> <i32 -1, i32 31, i32 2, i32 34>)
74 store <4 x i32> %0, <4 x i32>* @llvm_mips_bset_w_test_const_vec_res
78 declare <4 x i32> @llvm.mips.bset.w(<4 x i32>, <4 x i32>) nounwind
80 ; MIPS32: [[LABEL:\$CPI[0-9]+_[0-9]+]]:
81 ; MIPS64: [[LABEL:\.LCPI[0-9]+_[0-9]+]]:
82 ; ALL: .4byte 2147483648 # 0x80000000
83 ; ALL: .4byte 2147483648 # 0x80000000
86 ; ALL-LABEL: llvm_mips_bset_w_test_const_vec:
87 ; MIPS32: lw $[[R2:[0-9]+]], %got([[LABEL]])($[[R1:[0-9]+]])
88 ; MIPS32: addiu $[[R2]], $[[R2]], %lo([[LABEL]])
89 ; MIPS32: lw $[[R3:[0-9]+]], %got(llvm_mips_bset_w_test_const_vec_res)($[[R1]])
90 ; MIPS64: ld $[[R2:[0-9]+]], %got_page([[LABEL]])($[[R1:[0-9]+]])
91 ; MIPS64: daddiu $[[R2]], $[[R2]], %got_ofst([[LABEL]])
92 ; MIPS64: ld $[[R3:[0-9]+]], %got_disp(llvm_mips_bset_w_test_const_vec_res)($[[R1]])
93 ; ALL: ld.w $w0, 0($[[R2]])
94 ; ALL: st.w $w0, 0($[[R3]])
96 @llvm_mips_sll_w_test_const_vec_res = global <4 x i32> zeroinitializer, align 16
98 define void @llvm_mips_sll_w_test_const_vec() nounwind {
100 %0 = tail call <4 x i32> @llvm.mips.sll.w(<4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 31, i32 2, i32 34>)
101 store <4 x i32> %0, <4 x i32>* @llvm_mips_sll_w_test_const_vec_res
105 declare <4 x i32> @llvm.mips.sll.w(<4 x i32>, <4 x i32>) nounwind
107 ; MIPS32: [[LABEL:\$CPI[0-9]+_[0-9]+]]:
108 ; MIPS64: [[LABEL:\.LCPI[0-9]+_[0-9]+]]:
109 ; ALL: .4byte 2147483648 # 0x80000000
110 ; ALL: .4byte 2147483648 # 0x80000000
111 ; ALL: .4byte 4 # 0x4
112 ; ALL: .4byte 4 # 0x4
113 ; ALL-LABEL: llvm_mips_sll_w_test_const_vec:
114 ; MIPS32: lw $[[R2:[0-9]+]], %got([[LABEL]])($[[R1:[0-9]+]])
115 ; MIPS32: addiu $[[R2]], $[[R2]], %lo([[LABEL]])
116 ; MIPS32: lw $[[R3:[0-9]+]], %got(llvm_mips_sll_w_test_const_vec_res)($[[R1]])
117 ; MIPS64: ld $[[R2:[0-9]+]], %got_page([[LABEL]])($[[R1:[0-9]+]])
118 ; MIPS64: daddiu $[[R2]], $[[R2]], %got_ofst([[LABEL]])
119 ; MIPS64: ld $[[R3:[0-9]+]], %got_disp(llvm_mips_sll_w_test_const_vec_res)($[[R1]])
120 ; ALL: ld.w $w0, 0($[[R2]])
121 ; ALL: st.w $w0, 0($[[R3]])
123 @llvm_mips_sra_w_test_const_vec_res = global <4 x i32> zeroinitializer, align 16
125 define void @llvm_mips_sra_w_test_const_vec() nounwind {
127 %0 = tail call <4 x i32> @llvm.mips.sra.w(<4 x i32> <i32 -16, i32 16, i32 16, i32 16>, <4 x i32> <i32 2, i32 -30, i32 33, i32 1>)
128 store <4 x i32> %0, <4 x i32>* @llvm_mips_sra_w_test_const_vec_res
132 declare <4 x i32> @llvm.mips.sra.w(<4 x i32>, <4 x i32>) nounwind
134 ; MIPS32: [[LABEL:\$CPI[0-9]+_[0-9]+]]:
135 ; MIPS64: [[LABEL:\.LCPI[0-9]+_[0-9]+]]:
136 ; ALL: .4byte 4294967292 # 0xfffffffc
137 ; ALL: .4byte 4 # 0x4
138 ; ALL: .4byte 8 # 0x8
139 ; ALL: .4byte 8 # 0x8
140 ; ALL-LABEL: llvm_mips_sra_w_test_const_vec:
141 ; MIPS32: lw $[[R2:[0-9]+]], %got([[LABEL]])($[[R1:[0-9]+]])
142 ; MIPS32: addiu $[[R2]], $[[R2]], %lo([[LABEL]])
143 ; MIPS32: lw $[[R3:[0-9]+]], %got(llvm_mips_sra_w_test_const_vec_res)($[[R1]])
144 ; MIPS64: ld $[[R2:[0-9]+]], %got_page([[LABEL]])($[[R1:[0-9]+]])
145 ; MIPS64: daddiu $[[R2]], $[[R2]], %got_ofst([[LABEL]])
146 ; MIPS64: ld $[[R3:[0-9]+]], %got_disp(llvm_mips_sra_w_test_const_vec_res)($[[R1]])
147 ; ALL: ld.w $w0, 0($[[R2]])
148 ; ALL: st.w $w0, 0($[[R3]])
150 @llvm_mips_srl_w_test_const_vec_res = global <4 x i32> zeroinitializer, align 16
152 define void @llvm_mips_srl_w_test_const_vec() nounwind {
154 %0 = tail call <4 x i32> @llvm.mips.srl.w(<4 x i32> <i32 -16, i32 16, i32 16, i32 16>, <4 x i32> <i32 2, i32 -30, i32 33, i32 1>)
155 store <4 x i32> %0, <4 x i32>* @llvm_mips_srl_w_test_const_vec_res
159 declare <4 x i32> @llvm.mips.srl.w(<4 x i32>, <4 x i32>) nounwind
161 ; MIPS32: [[LABEL:\$CPI[0-9]+_[0-9]+]]:
162 ; MIPS64: [[LABEL:\.LCPI[0-9]+_[0-9]+]]:
163 ; ALL: .4byte 1073741820 # 0x3ffffffc
164 ; ALL: .4byte 4 # 0x4
165 ; ALL: .4byte 8 # 0x8
166 ; ALL: .4byte 8 # 0x8
167 ; ALL-LABEL: llvm_mips_srl_w_test_const_vec:
168 ; MIPS32: lw $[[R2:[0-9]+]], %got([[LABEL]])($[[R1:[0-9]+]])
169 ; MIPS32: addiu $[[R2]], $[[R2]], %lo([[LABEL]])
170 ; MIPS32: lw $[[R3:[0-9]+]], %got(llvm_mips_srl_w_test_const_vec_res)($[[R1]])
171 ; MIPS64: ld $[[R2:[0-9]+]], %got_page([[LABEL]])($[[R1:[0-9]+]])
172 ; MIPS64: daddiu $[[R2]], $[[R2]], %got_ofst([[LABEL]])
173 ; MIPS64: ld $[[R3:[0-9]+]], %got_disp(llvm_mips_srl_w_test_const_vec_res)($[[R1]])
174 ; ALL: ld.w $w0, 0($[[R2]])
175 ; ALL: st.w $w0, 0($[[R3]])