-
Notifications
You must be signed in to change notification settings - Fork 745
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
Fuzzer: Add SIMD support to DeNaN #6318
Changes from all commits
aefdf03
43bb800
2a75520
7c7ff81
44e6c86
96469aa
0cea4f4
d195c00
42e81f2
d970d6a
d4bfec9
66c2c50
eaf35dc
c08fa5d
cf07915
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 |
---|---|---|
@@ -0,0 +1,131 @@ | ||
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. | ||
|
||
;; RUN: foreach %s %t wasm-opt --denan -all -S -o - | filecheck %s | ||
|
||
(module | ||
;; CHECK: (type $0 (func (param v128) (result v128))) | ||
|
||
;; CHECK: (type $1 (func (param f32) (result f32))) | ||
|
||
;; CHECK: (type $2 (func (param f64) (result f64))) | ||
|
||
;; CHECK: (func $foo128 (type $0) (param $x v128) (result v128) | ||
;; CHECK-NEXT: (local.set $x | ||
;; CHECK-NEXT: (call $deNan128 | ||
;; CHECK-NEXT: (local.get $x) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (drop | ||
;; CHECK-NEXT: (call $deNan128 | ||
;; CHECK-NEXT: (v128.const i32x4 0x00000001 0x00000002 0x00000003 0x00000004) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (drop | ||
;; CHECK-NEXT: (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (drop | ||
;; CHECK-NEXT: (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (call $deNan128 | ||
;; CHECK-NEXT: (call $foo128 | ||
;; CHECK-NEXT: (local.get $x) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
(func $foo128 (param $x v128) (result v128) | ||
;; The incoming param will be de-naned. | ||
|
||
;; This is not a NaN. (We do still emit a call for it atm, FIXME) | ||
(drop | ||
(v128.const i32x4 0x00000001 0x00000002 0x00000003 0x00000004) | ||
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. It would be useful to write the tests using 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 was actually thinking it is nice to see the actual bits because of how they are used in the pass (the explanation about the f32 and f64 bits overlapping etc.)? 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. To be more specific, in this test code: ;; This is an f64 NaN and also an f32. It will become 0's.
(drop
(v128.const i32x4 0xffffffff 0x00000002 0x00000003 0x00000004)
)
;; This is an f32 NaN and not an f64. It will also become 0's.
(drop
(v128.const i32x4 0x00000001 0xffffffff 0x00000003 0x00000004)
) It is nice to see the bits, because that allows the comments to clarify how the same bits can be both f32 and f64 nans, or not. 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 would be more convinced by this if readers were likely to know off the top of their heads what bit patterns correspond to NaNs. I know I don't :) 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. Heh, I don't know that either, but I mentioned it in the pass (8 vs 11 top non-sign bits). |
||
) | ||
;; This is an f64 NaN and also an f32. It will become 0's. | ||
(drop | ||
(v128.const i32x4 0xffffffff 0x00000002 0x00000003 0x00000004) | ||
) | ||
;; This is an f32 NaN and not an f64. It will also become 0's. | ||
(drop | ||
(v128.const i32x4 0x00000001 0xffffffff 0x00000003 0x00000004) | ||
) | ||
|
||
(call $foo128 (local.get $x)) | ||
) | ||
) | ||
;; CHECK: (func $deNan32 (type $1) (param $0 f32) (result f32) | ||
;; CHECK-NEXT: (if (result f32) | ||
;; CHECK-NEXT: (f32.eq | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (then | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (else | ||
;; CHECK-NEXT: (f32.const 0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
|
||
;; CHECK: (func $deNan64 (type $2) (param $0 f64) (result f64) | ||
;; CHECK-NEXT: (if (result f64) | ||
;; CHECK-NEXT: (f64.eq | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (then | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (else | ||
;; CHECK-NEXT: (f64.const 0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
|
||
;; CHECK: (func $deNan128 (type $0) (param $0 v128) (result v128) | ||
;; CHECK-NEXT: (if (result v128) | ||
;; CHECK-NEXT: (i32.and | ||
;; CHECK-NEXT: (i32.and | ||
;; CHECK-NEXT: (f32.eq | ||
;; CHECK-NEXT: (f32x4.extract_lane 0 | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (f32x4.extract_lane 0 | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (f32.eq | ||
;; CHECK-NEXT: (f32x4.extract_lane 1 | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (f32x4.extract_lane 1 | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (i32.and | ||
;; CHECK-NEXT: (f32.eq | ||
;; CHECK-NEXT: (f32x4.extract_lane 2 | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (f32x4.extract_lane 2 | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (f32.eq | ||
;; CHECK-NEXT: (f32x4.extract_lane 3 | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (f32x4.extract_lane 3 | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (then | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (else | ||
;; CHECK-NEXT: (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) |
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.
Why does this happen?
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.
No good reason - that's what the code did for f32 and f64 before this PR. I can fix it later.