5 .macro test_shift prefix, dst, src, v, imm
6 \prefix\()_set \dst, \src, \v, \imm
7 \prefix\()_ver \dst, \v, \imm
10 .macro test_shift_sd prefix, v, imm
11 test_shift \prefix, a3, a2, \v, \imm
12 test_shift \prefix, a2, a2, \v, \imm
15 .macro tests_imm_shift prefix, v
16 test_shift_sd \prefix, \v, 1
17 test_shift_sd \prefix, \v, 2
18 test_shift_sd \prefix, \v, 7
19 test_shift_sd \prefix, \v, 8
20 test_shift_sd \prefix, \v, 15
21 test_shift_sd \prefix, \v, 16
22 test_shift_sd \prefix, \v, 31
25 .macro tests_shift prefix, v
26 test_shift_sd \prefix, \v, 0
27 tests_imm_shift \prefix, \v
28 test_shift_sd \prefix, \v, 32
32 .macro slli_set dst, src, v, imm
37 .macro slli_ver dst, v, imm
39 movi a3, ((\v) << (\imm)) & 0xffffffff
44 tests_imm_shift slli, 0xa3c51249
48 .macro srai_set dst, src, v, imm
53 .macro srai_ver dst, v, imm
56 movi a3, (((\v) >> (\imm)) & 0xffffffff) | \
57 ~((((\v) & 0x80000000) >> ((\imm) - 1)) - 1)
65 tests_imm_shift srai, 0x49a3c512
66 tests_imm_shift srai, 0xa3c51249
70 .macro srli_set dst, src, v, imm
75 .macro srli_ver dst, v, imm
77 movi a3, (((\v) >> (\imm)) & 0xffffffff)
82 tests_imm_shift srli, 0x49a3c512
83 tests_imm_shift srli, 0xa3c51249
87 .macro sll_set dst, src, v, imm
94 .macro sll_sar_set dst, src, v, imm
101 .macro sll_ver dst, v, imm
102 slli_ver \dst, \v, (\imm) & 0x1f
105 .macro sll_sar_ver dst, v, imm
106 slli_ver \dst, \v, \imm
110 tests_shift sll, 0xa3c51249
111 tests_shift sll_sar, 0xa3c51249
115 .macro srl_set dst, src, v, imm
122 .macro srl_sar_set dst, src, v, imm
129 .macro srl_ver dst, v, imm
130 srli_ver \dst, \v, (\imm) & 0x1f
133 .macro srl_sar_ver dst, v, imm
134 srli_ver \dst, \v, \imm
138 tests_shift srl, 0xa3c51249
139 tests_shift srl_sar, 0xa3c51249
140 tests_shift srl, 0x49a3c512
141 tests_shift srl_sar, 0x49a3c512
145 .macro sra_set dst, src, v, imm
152 .macro sra_sar_set dst, src, v, imm
159 .macro sra_ver dst, v, imm
160 srai_ver \dst, \v, (\imm) & 0x1f
163 .macro sra_sar_ver dst, v, imm
164 srai_ver \dst, \v, \imm
168 tests_shift sra, 0xa3c51249
169 tests_shift sra_sar, 0xa3c51249
170 tests_shift sra, 0x49a3c512
171 tests_shift sra_sar, 0x49a3c512
175 .macro src_set dst, src, v, imm
178 movi \src, (\v) & 0xffffffff
183 .macro src_sar_set dst, src, v, imm
186 movi \src, (\v) & 0xffffffff
191 .macro src_ver dst, v, imm
192 src_sar_ver \dst, \v, (\imm) & 0x1f
195 .macro src_sar_ver dst, v, imm
197 movi a3, ((\v) >> (\imm)) & 0xffffffff
202 tests_shift src, 0xa3c51249215c3a94
203 tests_shift src_sar, 0xa3c51249215c3a94