| 1 |
// |jit-test| skip-if: !wasmSimdEnabled() || !hasDisassembler() || wasmCompileMode() != "ion" || !getBuildConfiguration("x64") || getBuildConfiguration("simulator") || isAvxPresent(); include:codegen-x64-test.js |
| 2 |
|
| 3 |
// Test encoding of the all_true, and any_true operations. |
| 4 |
|
| 5 |
codegenTestX64_v128_i32( |
| 6 |
[['v128.any_true', ` |
| 7 |
33 c0 xor %eax, %eax |
| 8 |
66 0f 38 17 c0 ptest %xmm0, %xmm0 |
| 9 |
0f 95 c0 setnz %al`], |
| 10 |
['i8x16.all_true', ` |
| 11 |
33 c0 xor %eax, %eax |
| 12 |
66 45 0f ef ff pxor %xmm15, %xmm15 |
| 13 |
66 44 0f 74 f8 pcmpeqb %xmm0, %xmm15 |
| 14 |
66 45 0f 38 17 ff ptest %xmm15, %xmm15 |
| 15 |
0f 94 c0 setz %al`], |
| 16 |
['i16x8.all_true', ` |
| 17 |
33 c0 xor %eax, %eax |
| 18 |
66 45 0f ef ff pxor %xmm15, %xmm15 |
| 19 |
66 44 0f 75 f8 pcmpeqw %xmm0, %xmm15 |
| 20 |
66 45 0f 38 17 ff ptest %xmm15, %xmm15 |
| 21 |
0f 94 c0 setz %al`], |
| 22 |
['i32x4.all_true', ` |
| 23 |
33 c0 xor %eax, %eax |
| 24 |
66 45 0f ef ff pxor %xmm15, %xmm15 |
| 25 |
66 44 0f 76 f8 pcmpeqd %xmm0, %xmm15 |
| 26 |
66 45 0f 38 17 ff ptest %xmm15, %xmm15 |
| 27 |
0f 94 c0 setz %al`], |
| 28 |
['i64x2.all_true', ` |
| 29 |
33 c0 xor %eax, %eax |
| 30 |
66 45 0f ef ff pxor %xmm15, %xmm15 |
| 31 |
66 44 0f 38 29 f8 pcmpeqq %xmm0, %xmm15 |
| 32 |
66 45 0f 38 17 ff ptest %xmm15, %xmm15 |
| 33 |
0f 94 c0 setz %al`]], {} |
| 34 |
) |
| 35 |
|
| 36 |
// Utils. |
| 37 |
function codegenTestX64_v128_i32(inputs, options = {}) { |
| 38 |
for ( let [op, expected] of inputs ) { |
| 39 |
codegenTestX64_adhoc(wrap(options, ` |
| 40 |
(func (export "f") (param v128) (result i32) |
| 41 |
(${op} (local.get 0)))`), |
| 42 |
'f', |
| 43 |
expected, |
| 44 |
options); |
| 45 |
} |
| 46 |
} |