-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Winch: Add
trunc_sat
instructions for x64 with AVX (#10226)
* Winch: Add `trunc_sat` instructions for x64 with AVX * Free temp register * Move implementations into helper methods * Remove duplicate Wast test entries
- Loading branch information
1 parent
b0b5d8f
commit 7f93c1e
Showing
12 changed files
with
685 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tests/disas/winch/x64/i32x4_trunc_sat_f32x4_s/const_avx.wat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.trunc_sat_f32x4_s (v128.const f32x4 1 2 3 4)) | ||
) | ||
) | ||
;; wasm[0]::function[0]: | ||
;; pushq %rbp | ||
;; movq %rsp, %rbp | ||
;; movq 8(%rdi), %r11 | ||
;; movq 0x10(%r11), %r11 | ||
;; addq $0x10, %r11 | ||
;; cmpq %rsp, %r11 | ||
;; ja 0x59 | ||
;; 1c: movq %rdi, %r14 | ||
;; subq $0x10, %rsp | ||
;; movq %rdi, 8(%rsp) | ||
;; movq %rsi, (%rsp) | ||
;; movdqu 0x2c(%rip), %xmm0 | ||
;; vcmpeqps %xmm0, %xmm0, %xmm15 | ||
;; vandps %xmm0, %xmm15, %xmm0 | ||
;; vpxor %xmm0, %xmm15, %xmm15 | ||
;; vcvttps2dq %xmm0, %xmm0 | ||
;; vpand %xmm0, %xmm15, %xmm15 | ||
;; vpsrad $0x1f, %xmm15, %xmm15 | ||
;; vpxor %xmm0, %xmm15, %xmm0 | ||
;; addq $0x10, %rsp | ||
;; popq %rbp | ||
;; retq | ||
;; 59: ud2 | ||
;; 5b: addb %al, (%rax) | ||
;; 5d: addb %al, (%rax) | ||
;; 5f: addb %al, (%rax) | ||
;; 61: addb %al, 0x3f(%rax) | ||
;; 67: addb %al, (%rax) | ||
;; 6a: addb %al, (%rax) |
48 changes: 48 additions & 0 deletions
48
tests/disas/winch/x64/i32x4_trunc_sat_f32x4_u/const_avx.wat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
;;! target = "x86_64" | ||
;;! test = "winch" | ||
;;! flags = [ "-Ccranelift-has-avx" ] | ||
|
||
(module | ||
(func (result v128) | ||
(i32x4.trunc_sat_f32x4_u (v128.const f32x4 1 2 3 4)) | ||
) | ||
) | ||
;; wasm[0]::function[0]: | ||
;; pushq %rbp | ||
;; movq %rsp, %rbp | ||
;; movq 8(%rdi), %r11 | ||
;; movq 0x10(%r11), %r11 | ||
;; addq $0x10, %r11 | ||
;; cmpq %rsp, %r11 | ||
;; ja 0x76 | ||
;; 1c: movq %rdi, %r14 | ||
;; subq $0x10, %rsp | ||
;; movq %rdi, 8(%rsp) | ||
;; movq %rsi, (%rsp) | ||
;; movdqu 0x4c(%rip), %xmm0 | ||
;; vxorps %xmm0, %xmm0, %xmm15 | ||
;; vmaxps %xmm15, %xmm0, %xmm0 | ||
;; vpcmpeqd %xmm15, %xmm15, %xmm15 | ||
;; vpsrld $1, %xmm15, %xmm15 | ||
;; vcvtdq2ps %xmm15, %xmm15 | ||
;; vcvttps2dq %xmm0, %xmm1 | ||
;; vsubps %xmm15, %xmm0, %xmm0 | ||
;; vcmpleps %xmm0, %xmm15, %xmm15 | ||
;; vcvttps2dq %xmm0, %xmm0 | ||
;; vpxor %xmm0, %xmm15, %xmm15 | ||
;; vpxor %xmm0, %xmm0, %xmm0 | ||
;; vpmaxsd %xmm0, %xmm15, %xmm0 | ||
;; vpaddd %xmm1, %xmm0, %xmm0 | ||
;; addq $0x10, %rsp | ||
;; popq %rbp | ||
;; retq | ||
;; 76: ud2 | ||
;; 78: addb %al, (%rax) | ||
;; 7a: addb %al, (%rax) | ||
;; 7c: addb %al, (%rax) | ||
;; 7e: addb %al, (%rax) | ||
;; 80: addb %al, (%rax) | ||
;; 82: cmpb $0, (%rdi) | ||
;; 85: addb %al, (%rax) | ||
;; 87: addb %al, (%rax) | ||
;; 8a: addb %al, (%rax) |
44 changes: 44 additions & 0 deletions
44
tests/disas/winch/x64/i32x4_trunc_sat_f64x2_s_zero/const_avx.wat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
;;! target = "x86_64" | ||
;;! test = "winch" | ||
;;! flags = [ "-Ccranelift-has-avx" ] | ||
|
||
(module | ||
(func (result v128) | ||
(i32x4.trunc_sat_f64x2_s_zero (v128.const f32x4 1 2 3 4)) | ||
) | ||
) | ||
;; wasm[0]::function[0]: | ||
;; pushq %rbp | ||
;; movq %rsp, %rbp | ||
;; movq 8(%rdi), %r11 | ||
;; movq 0x10(%r11), %r11 | ||
;; addq $0x10, %r11 | ||
;; cmpq %rsp, %r11 | ||
;; ja 0x50 | ||
;; 1c: movq %rdi, %r14 | ||
;; subq $0x10, %rsp | ||
;; movq %rdi, 8(%rsp) | ||
;; movq %rsi, (%rsp) | ||
;; movdqu 0x2c(%rip), %xmm0 | ||
;; vcmpeqpd %xmm0, %xmm0, %xmm15 | ||
;; vandpd 0x2f(%rip), %xmm15, %xmm15 | ||
;; vminpd %xmm15, %xmm0, %xmm0 | ||
;; vcvttpd2dq %xmm0, %xmm0 | ||
;; addq $0x10, %rsp | ||
;; popq %rbp | ||
;; retq | ||
;; 50: ud2 | ||
;; 52: addb %al, (%rax) | ||
;; 54: addb %al, (%rax) | ||
;; 56: addb %al, (%rax) | ||
;; 58: addb %al, (%rax) | ||
;; 5a: addb %al, (%rax) | ||
;; 5c: addb %al, (%rax) | ||
;; 5e: addb %al, (%rax) | ||
;; 60: addb %al, (%rax) | ||
;; 62: cmpb $0, (%rdi) | ||
;; 65: addb %al, (%rax) | ||
;; 67: addb %al, (%rax) | ||
;; 6a: addb %al, (%rax) | ||
;; 6e: addb $0, (%rax) | ||
;; 72: sarb $0xff, %bh |
46 changes: 46 additions & 0 deletions
46
tests/disas/winch/x64/i32x4_trunc_sat_f64x2_u_zero/const_avx.wat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
;;! target = "x86_64" | ||
;;! test = "winch" | ||
;;! flags = [ "-Ccranelift-has-avx" ] | ||
|
||
(module | ||
(func (result v128) | ||
(i32x4.trunc_sat_f64x2_u_zero (v128.const f32x4 1 2 3 4)) | ||
) | ||
) | ||
;; wasm[0]::function[0]: | ||
;; pushq %rbp | ||
;; movq %rsp, %rbp | ||
;; movq 8(%rdi), %r11 | ||
;; movq 0x10(%r11), %r11 | ||
;; addq $0x10, %r11 | ||
;; cmpq %rsp, %r11 | ||
;; ja 0x60 | ||
;; 1c: movq %rdi, %r14 | ||
;; subq $0x10, %rsp | ||
;; movq %rdi, 8(%rsp) | ||
;; movq %rsi, (%rsp) | ||
;; movdqu 0x3c(%rip), %xmm0 | ||
;; vxorpd %xmm15, %xmm15, %xmm15 | ||
;; vmaxpd %xmm15, %xmm0, %xmm0 | ||
;; vminpd 0x3a(%rip), %xmm0, %xmm0 | ||
;; vroundpd $3, %xmm0, %xmm0 | ||
;; vaddpd 0x3c(%rip), %xmm0, %xmm0 | ||
;; vshufps $0x88, %xmm15, %xmm0, %xmm0 | ||
;; addq $0x10, %rsp | ||
;; popq %rbp | ||
;; retq | ||
;; 60: ud2 | ||
;; 62: addb %al, (%rax) | ||
;; 64: addb %al, (%rax) | ||
;; 66: addb %al, (%rax) | ||
;; 68: addb %al, (%rax) | ||
;; 6a: addb %al, (%rax) | ||
;; 6c: addb %al, (%rax) | ||
;; 6e: addb %al, (%rax) | ||
;; 70: addb %al, (%rax) | ||
;; 72: cmpb $0, (%rdi) | ||
;; 75: addb %al, (%rax) | ||
;; 77: addb %al, (%rax) | ||
;; 7a: addb %al, (%rax) | ||
;; 7e: addb $0, (%rax) | ||
;; 82: loopne 0x83 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.