Debian Codegraph @

js/src/jit-test/tests/wasm/simd/binop-x64-ion-codegen.js

raw
1 // |jit-test| skip-if: !wasmSimdEnabled() || !hasDisassembler() || wasmCompileMode() != "ion" || !getBuildConfiguration("x64") || getBuildConfiguration("simulator"); include:codegen-x64-test.js
2
3 // Test that there are no extraneous moves or fixups for sundry SIMD binary
4 // operations. See README-codegen.md for general information about this type of
5 // test case.
6
7 // Inputs (xmm0, xmm1)
8
9 codegenTestX64_v128xPTYPE_v128(
10 [['f32x4.replace_lane 0', 'f32', `f3 0f 10 c1 movss %xmm1, %xmm0`],
11 ['f32x4.replace_lane 1', 'f32', `66 0f 3a 21 c1 10 insertps \\$0x10, %xmm1, %xmm0`],
12 ['f32x4.replace_lane 3', 'f32', `66 0f 3a 21 c1 30 insertps \\$0x30, %xmm1, %xmm0`],
13 ['f64x2.replace_lane 0', 'f64', `f2 0f 10 c1 movsd %xmm1, %xmm0`],
14 ['f64x2.replace_lane 1', 'f64', `66 0f c6 c1 00 shufpd \\$0x00, %xmm1, %xmm0`]] );
15
16 // Inputs (xmm1, xmm0)
17
18 codegenTestX64_v128xv128_v128_reversed(
19 [['f32x4.pmin', `0f 5d c1 minps %xmm1, %xmm0`],
20 ['f32x4.pmax', `0f 5f c1 maxps %xmm1, %xmm0`],
21 ['f64x2.pmin', `66 0f 5d c1 minpd %xmm1, %xmm0`],
22 ['f64x2.pmax', `66 0f 5f c1 maxpd %xmm1, %xmm0`]] );
23
24 // Constant arguments that are folded into the instruction
25
26 codegenTestX64_v128xLITERAL_v128(
27 [['i8x16.add', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
28 `66 0f fc 05 ${RIPRADDR} paddbx ${RIPR}, %xmm0`],
29 ['i8x16.sub', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
30 `66 0f f8 05 ${RIPRADDR} psubbx ${RIPR}, %xmm0`],
31 ['i8x16.add_sat_s', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
32 `66 0f ec 05 ${RIPRADDR} paddsbx ${RIPR}, %xmm0`],
33 ['i8x16.add_sat_u', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
34 `66 0f dc 05 ${RIPRADDR} paddusbx ${RIPR}, %xmm0`],
35 ['i8x16.sub_sat_s', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
36 `66 0f e8 05 ${RIPRADDR} psubsbx ${RIPR}, %xmm0`],
37 ['i8x16.sub_sat_u', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
38 `66 0f d8 05 ${RIPRADDR} psubusbx ${RIPR}, %xmm0`],
39 ['i8x16.min_s', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
40 `66 0f 38 38 05 ${RIPRADDR} pminsbx ${RIPR}, %xmm0`],
41 ['i8x16.min_u', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
42 `66 0f da 05 ${RIPRADDR} pminubx ${RIPR}, %xmm0`],
43 ['i8x16.max_s', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
44 `66 0f 38 3c 05 ${RIPRADDR} pmaxsbx ${RIPR}, %xmm0`],
45 ['i8x16.max_u', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
46 `66 0f de 05 ${RIPRADDR} pmaxubx ${RIPR}, %xmm0`],
47 ['i8x16.eq', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
48 `66 0f 74 05 ${RIPRADDR} pcmpeqbx ${RIPR}, %xmm0`],
49 ['i8x16.ne', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)', `
50 66 0f 74 05 ${RIPRADDR} pcmpeqbx ${RIPR}, %xmm0
51 66 45 0f 75 ff pcmpeqw %xmm15, %xmm15
52 66 41 0f ef c7 pxor %xmm15, %xmm0`],
53 ['i8x16.gt_s', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
54 `66 0f 64 05 ${RIPRADDR} pcmpgtbx ${RIPR}, %xmm0`],
55 ['i8x16.le_s', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)', `
56 66 0f 64 05 ${RIPRADDR} pcmpgtbx ${RIPR}, %xmm0
57 66 45 0f 75 ff pcmpeqw %xmm15, %xmm15
58 66 41 0f ef c7 pxor %xmm15, %xmm0`],
59 ['i8x16.narrow_i16x8_s', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
60 `66 0f 63 05 ${RIPRADDR} packsswbx ${RIPR}, %xmm0`],
61 ['i8x16.narrow_i16x8_u', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
62 `66 0f 67 05 ${RIPRADDR} packuswbx ${RIPR}, %xmm0`],
63
64 ['i16x8.add', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
65 `66 0f fd 05 ${RIPRADDR} paddwx ${RIPR}, %xmm0`],
66 ['i16x8.sub', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
67 `66 0f f9 05 ${RIPRADDR} psubwx ${RIPR}, %xmm0`],
68 ['i16x8.mul', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
69 `66 0f d5 05 ${RIPRADDR} pmullwx ${RIPR}, %xmm0`],
70 ['i16x8.add_sat_s', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
71 `66 0f ed 05 ${RIPRADDR} paddswx ${RIPR}, %xmm0`],
72 ['i16x8.add_sat_u', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
73 `66 0f dd 05 ${RIPRADDR} padduswx ${RIPR}, %xmm0`],
74 ['i16x8.sub_sat_s', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
75 `66 0f e9 05 ${RIPRADDR} psubswx ${RIPR}, %xmm0`],
76 ['i16x8.sub_sat_u', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
77 `66 0f d9 05 ${RIPRADDR} psubuswx ${RIPR}, %xmm0`],
78 ['i16x8.min_s', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
79 `66 0f ea 05 ${RIPRADDR} pminswx ${RIPR}, %xmm0`],
80 ['i16x8.min_u', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
81 `66 0f 38 3a 05 ${RIPRADDR} pminuwx ${RIPR}, %xmm0`],
82 ['i16x8.max_s', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
83 `66 0f ee 05 ${RIPRADDR} pmaxswx ${RIPR}, %xmm0`],
84 ['i16x8.max_u', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
85 `66 0f 38 3e 05 ${RIPRADDR} pmaxuwx ${RIPR}, %xmm0`],
86 ['i16x8.eq', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
87 `66 0f 75 05 ${RIPRADDR} pcmpeqwx ${RIPR}, %xmm0`],
88 ['i16x8.ne', '(v128.const i16x8 1 2 1 2 1 2 1 2)', `
89 66 0f 75 05 ${RIPRADDR} pcmpeqwx ${RIPR}, %xmm0
90 66 45 0f 75 ff pcmpeqw %xmm15, %xmm15
91 66 41 0f ef c7 pxor %xmm15, %xmm0`],
92 ['i16x8.gt_s', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
93 `66 0f 65 05 ${RIPRADDR} pcmpgtwx ${RIPR}, %xmm0`],
94 ['i16x8.le_s', '(v128.const i16x8 1 2 1 2 1 2 1 2)', `
95 66 0f 65 05 ${RIPRADDR} pcmpgtwx ${RIPR}, %xmm0
96 66 45 0f 75 ff pcmpeqw %xmm15, %xmm15
97 66 41 0f ef c7 pxor %xmm15, %xmm0`],
98 ['i16x8.narrow_i32x4_s', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
99 `66 0f 6b 05 ${RIPRADDR} packssdwx ${RIPR}, %xmm0`],
100 ['i16x8.narrow_i32x4_u', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
101 `66 0f 38 2b 05 ${RIPRADDR} packusdwx ${RIPR}, %xmm0`],
102
103 ['i32x4.add', '(v128.const i32x4 1 2 1 2)',
104 `66 0f fe 05 ${RIPRADDR} padddx ${RIPR}, %xmm0`],
105 ['i32x4.sub', '(v128.const i32x4 1 2 1 2)',
106 `66 0f fa 05 ${RIPRADDR} psubdx ${RIPR}, %xmm0`],
107 ['i32x4.mul', '(v128.const i32x4 1 2 1 2)',
108 `66 0f 38 40 05 ${RIPRADDR} pmulldx ${RIPR}, %xmm0`],
109 ['i32x4.min_s', '(v128.const i32x4 1 2 1 2)',
110 `66 0f 38 39 05 ${RIPRADDR} pminsdx ${RIPR}, %xmm0`],
111 ['i32x4.min_u', '(v128.const i32x4 1 2 1 2)',
112 `66 0f 38 3b 05 ${RIPRADDR} pminudx ${RIPR}, %xmm0`],
113 ['i32x4.max_s', '(v128.const i32x4 1 2 1 2)',
114 `66 0f 38 3d 05 ${RIPRADDR} pmaxsdx ${RIPR}, %xmm0`],
115 ['i32x4.max_u', '(v128.const i32x4 1 2 1 2)',
116 `66 0f 38 3f 05 ${RIPRADDR} pmaxudx ${RIPR}, %xmm0`],
117 ['i32x4.eq', '(v128.const i32x4 1 2 1 2)',
118 `66 0f 76 05 ${RIPRADDR} pcmpeqdx ${RIPR}, %xmm0`],
119 ['i32x4.ne', '(v128.const i32x4 1 2 1 2)', `
120 66 0f 76 05 ${RIPRADDR} pcmpeqdx ${RIPR}, %xmm0
121 66 45 0f 75 ff pcmpeqw %xmm15, %xmm15
122 66 41 0f ef c7 pxor %xmm15, %xmm0`],
123 ['i32x4.gt_s', '(v128.const i32x4 1 2 1 2)',
124 `66 0f 66 05 ${RIPRADDR} pcmpgtdx ${RIPR}, %xmm0`],
125 ['i32x4.le_s', '(v128.const i32x4 1 2 1 2)', `
126 66 0f 66 05 ${RIPRADDR} pcmpgtdx ${RIPR}, %xmm0
127 66 45 0f 75 ff pcmpeqw %xmm15, %xmm15
128 66 41 0f ef c7 pxor %xmm15, %xmm0`],
129 ['i32x4.dot_i16x8_s', '(v128.const i32x4 1 2 1 2)',
130 `66 0f f5 05 ${RIPRADDR} pmaddwdx ${RIPR}, %xmm0`],
131
132 ['i64x2.add', '(v128.const i64x2 1 2)',
133 `66 0f d4 05 ${RIPRADDR} paddqx ${RIPR}, %xmm0`],
134 ['i64x2.sub', '(v128.const i64x2 1 2)',
135 `66 0f fb 05 ${RIPRADDR} psubqx ${RIPR}, %xmm0`],
136
137 ['v128.and', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
138 `66 0f db 05 ${RIPRADDR} pandx ${RIPR}, %xmm0`],
139 ['v128.or', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
140 `66 0f eb 05 ${RIPRADDR} porx ${RIPR}, %xmm0`],
141 ['v128.xor', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
142 `66 0f ef 05 ${RIPRADDR} pxorx ${RIPR}, %xmm0`],
143
144 ['f32x4.add', '(v128.const f32x4 1 2 3 4)',
145 `0f 58 05 ${RIPRADDR} addpsx ${RIPR}, %xmm0`],
146 ['f32x4.sub', '(v128.const f32x4 1 2 3 4)',
147 `0f 5c 05 ${RIPRADDR} subpsx ${RIPR}, %xmm0`],
148 ['f32x4.mul', '(v128.const f32x4 1 2 3 4)',
149 `0f 59 05 ${RIPRADDR} mulpsx ${RIPR}, %xmm0`],
150 ['f32x4.div', '(v128.const f32x4 1 2 3 4)',
151 `0f 5e 05 ${RIPRADDR} divpsx ${RIPR}, %xmm0`],
152 ['f32x4.eq', '(v128.const f32x4 1 2 3 4)',
153 `0f c2 05 ${RIPRADDR} 00 cmppsx \\$0x00, ${RIPR}, %xmm0`],
154 ['f32x4.ne', '(v128.const f32x4 1 2 3 4)',
155 `0f c2 05 ${RIPRADDR} 04 cmppsx \\$0x04, ${RIPR}, %xmm0`],
156 ['f32x4.lt', '(v128.const f32x4 1 2 3 4)',
157 `0f c2 05 ${RIPRADDR} 01 cmppsx \\$0x01, ${RIPR}, %xmm0`],
158 ['f32x4.le', '(v128.const f32x4 1 2 3 4)',
159 `0f c2 05 ${RIPRADDR} 02 cmppsx \\$0x02, ${RIPR}, %xmm0`],
160
161 ['f64x2.add', '(v128.const f64x2 1 2)',
162 `66 0f 58 05 ${RIPRADDR} addpdx ${RIPR}, %xmm0`],
163 ['f64x2.sub', '(v128.const f64x2 1 2)',
164 `66 0f 5c 05 ${RIPRADDR} subpdx ${RIPR}, %xmm0`],
165 ['f64x2.mul', '(v128.const f64x2 1 2)',
166 `66 0f 59 05 ${RIPRADDR} mulpdx ${RIPR}, %xmm0`],
167 ['f64x2.div', '(v128.const f64x2 1 2)',
168 `66 0f 5e 05 ${RIPRADDR} divpdx ${RIPR}, %xmm0`],
169 ['f64x2.eq', '(v128.const f64x2 1 2)',
170 `66 0f c2 05 ${RIPRADDR} 00 cmppdx \\$0x00, ${RIPR}, %xmm0`],
171 ['f64x2.ne', '(v128.const f64x2 1 2)',
172 `66 0f c2 05 ${RIPRADDR} 04 cmppdx \\$0x04, ${RIPR}, %xmm0`],
173 ['f64x2.lt', '(v128.const f64x2 1 2)',
174 `66 0f c2 05 ${RIPRADDR} 01 cmppdx \\$0x01, ${RIPR}, %xmm0`],
175 ['f64x2.le', '(v128.const f64x2 1 2)',
176 `66 0f c2 05 ${RIPRADDR} 02 cmppdx \\$0x02, ${RIPR}, %xmm0`]]);
177
178 // Commutative operations with constants on the lhs should generate the same
179 // code as with the constant on the rhs.
180
181 codegenTestX64_LITERALxv128_v128(
182 [['i8x16.add', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
183 `66 0f fc 05 ${RIPRADDR} paddbx ${RIPR}, %xmm0`],
184 ['i8x16.add_sat_s', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
185 `66 0f ec 05 ${RIPRADDR} paddsbx ${RIPR}, %xmm0`],
186 ['i8x16.add_sat_u', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
187 `66 0f dc 05 ${RIPRADDR} paddusbx ${RIPR}, %xmm0`],
188 ['i8x16.min_s', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
189 `66 0f 38 38 05 ${RIPRADDR} pminsbx ${RIPR}, %xmm0`],
190 ['i8x16.min_u', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
191 `66 0f da 05 ${RIPRADDR} pminubx ${RIPR}, %xmm0`],
192 ['i8x16.max_s', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
193 `66 0f 38 3c 05 ${RIPRADDR} pmaxsbx ${RIPR}, %xmm0`],
194 ['i8x16.max_u', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
195 `66 0f de 05 ${RIPRADDR} pmaxubx ${RIPR}, %xmm0`],
196 ['i8x16.eq', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
197 `66 0f 74 05 ${RIPRADDR} pcmpeqbx ${RIPR}, %xmm0`],
198 ['i8x16.ne', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)', `
199 66 0f 74 05 ${RIPRADDR} pcmpeqbx ${RIPR}, %xmm0
200 66 45 0f 75 ff pcmpeqw %xmm15, %xmm15
201 66 41 0f ef c7 pxor %xmm15, %xmm0`],
202
203 ['i16x8.add', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
204 `66 0f fd 05 ${RIPRADDR} paddwx ${RIPR}, %xmm0`],
205 ['i16x8.mul', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
206 `66 0f d5 05 ${RIPRADDR} pmullwx ${RIPR}, %xmm0`],
207 ['i16x8.add_sat_s', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
208 `66 0f ed 05 ${RIPRADDR} paddswx ${RIPR}, %xmm0`],
209 ['i16x8.add_sat_u', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
210 `66 0f dd 05 ${RIPRADDR} padduswx ${RIPR}, %xmm0`],
211 ['i16x8.min_s', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
212 `66 0f ea 05 ${RIPRADDR} pminswx ${RIPR}, %xmm0`],
213 ['i16x8.min_u', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
214 `66 0f 38 3a 05 ${RIPRADDR} pminuwx ${RIPR}, %xmm0`],
215 ['i16x8.max_s', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
216 `66 0f ee 05 ${RIPRADDR} pmaxswx ${RIPR}, %xmm0`],
217 ['i16x8.max_u', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
218 `66 0f 38 3e 05 ${RIPRADDR} pmaxuwx ${RIPR}, %xmm0`],
219 ['i16x8.eq', '(v128.const i16x8 1 2 1 2 1 2 1 2)',
220 `66 0f 75 05 ${RIPRADDR} pcmpeqwx ${RIPR}, %xmm0`],
221 ['i16x8.ne', '(v128.const i16x8 1 2 1 2 1 2 1 2)', `
222 66 0f 75 05 ${RIPRADDR} pcmpeqwx ${RIPR}, %xmm0
223 66 45 0f 75 ff pcmpeqw %xmm15, %xmm15
224 66 41 0f ef c7 pxor %xmm15, %xmm0`],
225
226 ['i32x4.add', '(v128.const i32x4 1 2 1 2)',
227 `66 0f fe 05 ${RIPRADDR} padddx ${RIPR}, %xmm0`],
228 ['i32x4.mul', '(v128.const i32x4 1 2 1 2)',
229 `66 0f 38 40 05 ${RIPRADDR} pmulldx ${RIPR}, %xmm0`],
230 ['i32x4.min_s', '(v128.const i32x4 1 2 1 2)',
231 `66 0f 38 39 05 ${RIPRADDR} pminsdx ${RIPR}, %xmm0`],
232 ['i32x4.min_u', '(v128.const i32x4 1 2 1 2)',
233 `66 0f 38 3b 05 ${RIPRADDR} pminudx ${RIPR}, %xmm0`],
234 ['i32x4.max_s', '(v128.const i32x4 1 2 1 2)',
235 `66 0f 38 3d 05 ${RIPRADDR} pmaxsdx ${RIPR}, %xmm0`],
236 ['i32x4.max_u', '(v128.const i32x4 1 2 1 2)',
237 `66 0f 38 3f 05 ${RIPRADDR} pmaxudx ${RIPR}, %xmm0`],
238 ['i32x4.eq', '(v128.const i32x4 1 2 1 2)',
239 `66 0f 76 05 ${RIPRADDR} pcmpeqdx ${RIPR}, %xmm0`],
240 ['i32x4.ne', '(v128.const i32x4 1 2 1 2)', `
241 66 0f 76 05 ${RIPRADDR} pcmpeqdx ${RIPR}, %xmm0
242 66 45 0f 75 ff pcmpeqw %xmm15, %xmm15
243 66 41 0f ef c7 pxor %xmm15, %xmm0`],
244 ['i32x4.dot_i16x8_s', '(v128.const i32x4 1 2 1 2)',
245 `66 0f f5 05 ${RIPRADDR} pmaddwdx ${RIPR}, %xmm0`],
246
247 ['i64x2.add', '(v128.const i64x2 1 2)',
248 `66 0f d4 05 ${RIPRADDR} paddqx ${RIPR}, %xmm0`],
249
250 ['v128.and', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
251 `66 0f db 05 ${RIPRADDR} pandx ${RIPR}, %xmm0`],
252 ['v128.or', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
253 `66 0f eb 05 ${RIPRADDR} porx ${RIPR}, %xmm0`],
254 ['v128.xor', '(v128.const i8x16 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2)',
255 `66 0f ef 05 ${RIPRADDR} pxorx ${RIPR}, %xmm0`]]);