Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Winch: implement v128 neg and shifts for x64 #10170

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions crates/wast-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ impl WastTest {
"misc_testsuite/simd/almost-extmul.wast",
"misc_testsuite/simd/canonicalize-nan.wast",
"misc_testsuite/simd/issue_3327_bnot_lowering.wast",
"spec_testsuite/simd_bit_shift.wast",
"spec_testsuite/simd_boolean.wast",
"spec_testsuite/simd_f32x4.wast",
"spec_testsuite/simd_f32x4_arith.wast",
Expand All @@ -433,25 +432,19 @@ impl WastTest {
"spec_testsuite/simd_f64x2_arith.wast",
"spec_testsuite/simd_f64x2_pmin_pmax.wast",
"spec_testsuite/simd_f64x2_rounding.wast",
"spec_testsuite/simd_i16x8_arith.wast",
"spec_testsuite/simd_i16x8_arith2.wast",
"spec_testsuite/simd_i16x8_extadd_pairwise_i8x16.wast",
"spec_testsuite/simd_i16x8_extmul_i8x16.wast",
"spec_testsuite/simd_i16x8_q15mulr_sat_s.wast",
"spec_testsuite/simd_i16x8_sat_arith.wast",
"spec_testsuite/simd_i32x4_arith.wast",
"spec_testsuite/simd_i32x4_arith2.wast",
"spec_testsuite/simd_i32x4_dot_i16x8.wast",
"spec_testsuite/simd_i32x4_extadd_pairwise_i16x8.wast",
"spec_testsuite/simd_i32x4_extmul_i16x8.wast",
"spec_testsuite/simd_i32x4_trunc_sat_f32x4.wast",
"spec_testsuite/simd_i32x4_trunc_sat_f64x2.wast",
"spec_testsuite/simd_i64x2_arith.wast",
"spec_testsuite/simd_i64x2_arith2.wast",
"spec_testsuite/simd_i64x2_extmul_i32x4.wast",
"spec_testsuite/simd_i8x16_arith.wast",
"spec_testsuite/simd_i8x16_arith2.wast",
"spec_testsuite/simd_i8x16_sat_arith.wast",
"spec_testsuite/simd_lane.wast",
"spec_testsuite/simd_load.wast",
"spec_testsuite/simd_load_zero.wast",
Expand Down Expand Up @@ -499,6 +492,13 @@ impl WastTest {
"multi-memory/simd_memory-multi.wast",
"misc_testsuite/simd/issue4807.wast",
"spec_testsuite/simd_const.wast",
"spec_testsuite/simd_i8x16_sat_arith.wast",
"spec_testsuite/simd_i64x2_arith.wast",
"spec_testsuite/simd_i16x8_arith.wast",
"spec_testsuite/simd_i32x4_arith.wast",
"spec_testsuite/simd_i16x8_sat_arith.wast",
"spec_testsuite/simd_i8x16_arith.wast",
"spec_testsuite/simd_bit_shift.wast",
];

if unsupported.iter().any(|part| self.path.ends_with(part)) {
Expand Down
33 changes: 33 additions & 0 deletions tests/disas/winch/x64/i16x8/neg/neg.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
;;! target = "x86_64"
;;! test = "winch"
;;! flags = [ "-Ccranelift-has-avx" ]

(module
(func (result v128)
(i16x8.neg (v128.const i64x2 0xFFFFFFFFFFFFFFFF 42)
)))
;; wasm[0]::function[0]:
;; pushq %rbp
;; movq %rsp, %rbp
;; movq 8(%rdi), %r11
;; movq 0x10(%r11), %r11
;; addq $0x10, %r11
;; cmpq %rsp, %r11
;; ja 0x43
;; 1c: movq %rdi, %r14
;; subq $0x10, %rsp
;; movq %rdi, 8(%rsp)
;; movq %rsi, (%rsp)
;; movdqu 0x1c(%rip), %xmm0
;; vpxor %xmm15, %xmm15, %xmm15
;; vpsubw %xmm0, %xmm15, %xmm0
;; addq $0x10, %rsp
;; popq %rbp
;; retq
;; 43: ud2
;; 45: addb %al, (%rax)
;; 47: addb %al, (%rax)
;; 49: addb %al, (%rax)
;; 4b: addb %al, (%rax)
;; 4d: addb %al, (%rax)
;; 4f: addb %bh, %bh
39 changes: 39 additions & 0 deletions tests/disas/winch/x64/i16x8/shift/shl.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;;! target = "x86_64"
;;! test = "winch"
;;! flags = [ "-Ccranelift-has-avx" ]

(module
(func (result v128)
(i16x8.shl (v128.const i64x2 1 2) (i32.const 3))
)
)
;; wasm[0]::function[0]:
;; pushq %rbp
;; movq %rsp, %rbp
;; movq 8(%rdi), %r11
;; movq 0x10(%r11), %r11
;; addq $0x10, %r11
;; cmpq %rsp, %r11
;; ja 0x4b
;; 1c: movq %rdi, %r14
;; subq $0x10, %rsp
;; movq %rdi, 8(%rsp)
;; movq %rsi, (%rsp)
;; movl $3, %eax
;; movdqu 0x17(%rip), %xmm0
;; andl $0xf, %eax
;; vmovd %eax, %xmm15
;; vpsllw %xmm15, %xmm0, %xmm0
;; addq $0x10, %rsp
;; popq %rbp
;; retq
;; 4b: ud2
;; 4d: addb %al, (%rax)
;; 4f: addb %al, (%rcx)
;; 51: addb %al, (%rax)
;; 53: addb %al, (%rax)
;; 55: addb %al, (%rax)
;; 57: addb %al, (%rdx)
;; 59: addb %al, (%rax)
;; 5b: addb %al, (%rax)
;; 5d: addb %al, (%rax)
39 changes: 39 additions & 0 deletions tests/disas/winch/x64/i16x8/shift/shr_s.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;;! target = "x86_64"
;;! test = "winch"
;;! flags = [ "-Ccranelift-has-avx" ]

(module
(func (result v128)
(i16x8.shr_s (v128.const i64x2 1 2) (i32.const 3))
)
)
;; wasm[0]::function[0]:
;; pushq %rbp
;; movq %rsp, %rbp
;; movq 8(%rdi), %r11
;; movq 0x10(%r11), %r11
;; addq $0x10, %r11
;; cmpq %rsp, %r11
;; ja 0x4b
;; 1c: movq %rdi, %r14
;; subq $0x10, %rsp
;; movq %rdi, 8(%rsp)
;; movq %rsi, (%rsp)
;; movl $3, %eax
;; movdqu 0x17(%rip), %xmm0
;; andl $0xf, %eax
;; vmovd %eax, %xmm15
;; vpsraw %xmm15, %xmm0, %xmm0
;; addq $0x10, %rsp
;; popq %rbp
;; retq
;; 4b: ud2
;; 4d: addb %al, (%rax)
;; 4f: addb %al, (%rcx)
;; 51: addb %al, (%rax)
;; 53: addb %al, (%rax)
;; 55: addb %al, (%rax)
;; 57: addb %al, (%rdx)
;; 59: addb %al, (%rax)
;; 5b: addb %al, (%rax)
;; 5d: addb %al, (%rax)
39 changes: 39 additions & 0 deletions tests/disas/winch/x64/i16x8/shift/shr_u.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;;! target = "x86_64"
;;! test = "winch"
;;! flags = [ "-Ccranelift-has-avx" ]

(module
(func (result v128)
(i16x8.shr_u (v128.const i64x2 1 2) (i32.const 3))
)
)
;; wasm[0]::function[0]:
;; pushq %rbp
;; movq %rsp, %rbp
;; movq 8(%rdi), %r11
;; movq 0x10(%r11), %r11
;; addq $0x10, %r11
;; cmpq %rsp, %r11
;; ja 0x4b
;; 1c: movq %rdi, %r14
;; subq $0x10, %rsp
;; movq %rdi, 8(%rsp)
;; movq %rsi, (%rsp)
;; movl $3, %eax
;; movdqu 0x17(%rip), %xmm0
;; andl $0xf, %eax
;; vmovd %eax, %xmm15
;; vpsrlw %xmm15, %xmm0, %xmm0
;; addq $0x10, %rsp
;; popq %rbp
;; retq
;; 4b: ud2
;; 4d: addb %al, (%rax)
;; 4f: addb %al, (%rcx)
;; 51: addb %al, (%rax)
;; 53: addb %al, (%rax)
;; 55: addb %al, (%rax)
;; 57: addb %al, (%rdx)
;; 59: addb %al, (%rax)
;; 5b: addb %al, (%rax)
;; 5d: addb %al, (%rax)
33 changes: 33 additions & 0 deletions tests/disas/winch/x64/i32x4/neg/neg.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
;;! target = "x86_64"
;;! test = "winch"
;;! flags = [ "-Ccranelift-has-avx" ]

(module
(func (result v128)
(i32x4.neg (v128.const i64x2 0xFFFFFFFFFFFFFFFF 42)
)))
;; wasm[0]::function[0]:
;; pushq %rbp
;; movq %rsp, %rbp
;; movq 8(%rdi), %r11
;; movq 0x10(%r11), %r11
;; addq $0x10, %r11
;; cmpq %rsp, %r11
;; ja 0x43
;; 1c: movq %rdi, %r14
;; subq $0x10, %rsp
;; movq %rdi, 8(%rsp)
;; movq %rsi, (%rsp)
;; movdqu 0x1c(%rip), %xmm0
;; vpxor %xmm15, %xmm15, %xmm15
;; vpsubd %xmm0, %xmm15, %xmm0
;; addq $0x10, %rsp
;; popq %rbp
;; retq
;; 43: ud2
;; 45: addb %al, (%rax)
;; 47: addb %al, (%rax)
;; 49: addb %al, (%rax)
;; 4b: addb %al, (%rax)
;; 4d: addb %al, (%rax)
;; 4f: addb %bh, %bh
39 changes: 39 additions & 0 deletions tests/disas/winch/x64/i32x4/shift/shl.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;;! target = "x86_64"
;;! test = "winch"
;;! flags = [ "-Ccranelift-has-avx" ]

(module
(func (result v128)
(i32x4.shl (v128.const i64x2 1 2) (i32.const 3))
)
)
;; wasm[0]::function[0]:
;; pushq %rbp
;; movq %rsp, %rbp
;; movq 8(%rdi), %r11
;; movq 0x10(%r11), %r11
;; addq $0x10, %r11
;; cmpq %rsp, %r11
;; ja 0x4b
;; 1c: movq %rdi, %r14
;; subq $0x10, %rsp
;; movq %rdi, 8(%rsp)
;; movq %rsi, (%rsp)
;; movl $3, %eax
;; movdqu 0x17(%rip), %xmm0
;; andl $0x1f, %eax
;; vmovd %eax, %xmm15
;; vpslld %xmm15, %xmm0, %xmm0
;; addq $0x10, %rsp
;; popq %rbp
;; retq
;; 4b: ud2
;; 4d: addb %al, (%rax)
;; 4f: addb %al, (%rcx)
;; 51: addb %al, (%rax)
;; 53: addb %al, (%rax)
;; 55: addb %al, (%rax)
;; 57: addb %al, (%rdx)
;; 59: addb %al, (%rax)
;; 5b: addb %al, (%rax)
;; 5d: addb %al, (%rax)
39 changes: 39 additions & 0 deletions tests/disas/winch/x64/i32x4/shift/shr_s.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;;! target = "x86_64"
;;! test = "winch"
;;! flags = [ "-Ccranelift-has-avx" ]

(module
(func (result v128)
(i32x4.shr_s (v128.const i64x2 1 2) (i32.const 3))
)
)
;; wasm[0]::function[0]:
;; pushq %rbp
;; movq %rsp, %rbp
;; movq 8(%rdi), %r11
;; movq 0x10(%r11), %r11
;; addq $0x10, %r11
;; cmpq %rsp, %r11
;; ja 0x4b
;; 1c: movq %rdi, %r14
;; subq $0x10, %rsp
;; movq %rdi, 8(%rsp)
;; movq %rsi, (%rsp)
;; movl $3, %eax
;; movdqu 0x17(%rip), %xmm0
;; andl $0x1f, %eax
;; vmovd %eax, %xmm15
;; vpsrad %xmm15, %xmm0, %xmm0
;; addq $0x10, %rsp
;; popq %rbp
;; retq
;; 4b: ud2
;; 4d: addb %al, (%rax)
;; 4f: addb %al, (%rcx)
;; 51: addb %al, (%rax)
;; 53: addb %al, (%rax)
;; 55: addb %al, (%rax)
;; 57: addb %al, (%rdx)
;; 59: addb %al, (%rax)
;; 5b: addb %al, (%rax)
;; 5d: addb %al, (%rax)
39 changes: 39 additions & 0 deletions tests/disas/winch/x64/i32x4/shift/shr_u.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;;! target = "x86_64"
;;! test = "winch"
;;! flags = [ "-Ccranelift-has-avx" ]

(module
(func (result v128)
(i32x4.shr_u (v128.const i64x2 1 2) (i32.const 3))
)
)
;; wasm[0]::function[0]:
;; pushq %rbp
;; movq %rsp, %rbp
;; movq 8(%rdi), %r11
;; movq 0x10(%r11), %r11
;; addq $0x10, %r11
;; cmpq %rsp, %r11
;; ja 0x4b
;; 1c: movq %rdi, %r14
;; subq $0x10, %rsp
;; movq %rdi, 8(%rsp)
;; movq %rsi, (%rsp)
;; movl $3, %eax
;; movdqu 0x17(%rip), %xmm0
;; andl $0x1f, %eax
;; vmovd %eax, %xmm15
;; vpsrld %xmm15, %xmm0, %xmm0
;; addq $0x10, %rsp
;; popq %rbp
;; retq
;; 4b: ud2
;; 4d: addb %al, (%rax)
;; 4f: addb %al, (%rcx)
;; 51: addb %al, (%rax)
;; 53: addb %al, (%rax)
;; 55: addb %al, (%rax)
;; 57: addb %al, (%rdx)
;; 59: addb %al, (%rax)
;; 5b: addb %al, (%rax)
;; 5d: addb %al, (%rax)
33 changes: 33 additions & 0 deletions tests/disas/winch/x64/i64x2/neg/neg.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
;;! target = "x86_64"
;;! test = "winch"
;;! flags = [ "-Ccranelift-has-avx" ]

(module
(func (result v128)
(i64x2.neg (v128.const i64x2 0xFFFFFFFFFFFFFFFF 42)
)))
;; wasm[0]::function[0]:
;; pushq %rbp
;; movq %rsp, %rbp
;; movq 8(%rdi), %r11
;; movq 0x10(%r11), %r11
;; addq $0x10, %r11
;; cmpq %rsp, %r11
;; ja 0x43
;; 1c: movq %rdi, %r14
;; subq $0x10, %rsp
;; movq %rdi, 8(%rsp)
;; movq %rsi, (%rsp)
;; movdqu 0x1c(%rip), %xmm0
;; vpxor %xmm15, %xmm15, %xmm15
;; vpsubq %xmm0, %xmm15, %xmm0
;; addq $0x10, %rsp
;; popq %rbp
;; retq
;; 43: ud2
;; 45: addb %al, (%rax)
;; 47: addb %al, (%rax)
;; 49: addb %al, (%rax)
;; 4b: addb %al, (%rax)
;; 4d: addb %al, (%rax)
;; 4f: addb %bh, %bh
Loading