-
Notifications
You must be signed in to change notification settings - Fork 10
Alternative output for i32x4_relaxed_trunc.wast tests #140
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,13 +50,19 @@ | |
| (v128.const f32x4 0 -1.0 4294967040.0 4294967296.0)) | ||
| ;; out of range -> saturate or UINT32_MAX | ||
| (either (v128.const i32x4 0 0 4294967040 0xffffffff) | ||
| (v128.const i32x4 0 0xffffffff 4294967040 0xffffffff))) | ||
| (v128.const i32x4 0 0xffffffff 4294967040 0xffffffff) | ||
| ;; output generated by the algorithm in V8 and SpiderMonkey | ||
| (v128.const i32x4 0 0xffffffff 4294967040 0))) | ||
|
|
||
| (assert_return (invoke "i32x4.relaxed_trunc_f32x4_u" | ||
| (v128.const f32x4 nan -nan nan:0x444444 -nan:0x444444)) | ||
| ;; nans -> 0 or UINT32_MAX | ||
| (either (v128.const i32x4 0 0 0 0) | ||
| (v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffffffff))) | ||
| (v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffffffff) | ||
| ;; output generated by the algorithm in V8 | ||
| (v128.const i32x4 0xc0000000 0xc0000000 0xc4444400 0xc4444400) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't covered by #144 either. |
||
| ;; output generated by the algorithm in SpiderMonkey | ||
| (v128.const i32x4 0x80000000 0x80000000 0x80000000 0x80000000))) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 0x800000 comes from VCVTTPS2UDQ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about that but I cannot refer the algorithm/recipe by name, or issue that defines these. I'll just refer SM and V8 as source.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually it is different on V8, it looks like
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| (assert_return (invoke "i32x4.relaxed_trunc_f64x2_s_zero" | ||
| (v128.const f64x2 -2147483904.0 2147483904.0)) | ||
|
|
@@ -73,7 +79,9 @@ | |
| (v128.const f64x2 -1.0 4294967296.0)) | ||
| ;; out of range -> saturate or UINT32_MAX | ||
| (either (v128.const i32x4 0 0xffffffff 0 0) | ||
| (v128.const i32x4 0xffffffff 0xffffffff 0 0))) | ||
| (v128.const i32x4 0xffffffff 0xffffffff 0 0) | ||
| ;; output generated by the algorithm in V8 and SpiderMonkey | ||
| (v128.const i32x4 0xfffffffe 0 0 0))) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we get
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC when I was stepping in the debugger: 0xfffffffe comes from
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the addpd from implementing this relaxed instruction using the simd128 one? (i32x4.trunc_sat_f64x2_s_zero)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. V8 (turbofan?) generates: (notice that liftoff generates trunc_sat_f64x2_s_zero code, not relaxed)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess that implementation comes from WebAssembly/simd#383 "x86/x86-64 processors with AVX instruction set". Using the trunc_sat instruction to implement the relaxed instruction is always correct (for all the relaxed instructions). This is so that in deterministic mode, we can fall back to SIMD128 instructions.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This discussion seems to conclude that 0xfffffffe is a bug, yet it made it into #144. I'm confused. |
||
|
|
||
| (assert_return (invoke "i32x4.relaxed_trunc_f64x2_u_zero" | ||
| (v128.const f64x2 nan -nan)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like this case was covered by #144?