aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/fuse.go80
1 files changed, 80 insertions, 0 deletions
diff --git a/test/codegen/fuse.go b/test/codegen/fuse.go
index 8d6ea3c5c7..561bac7224 100644
--- a/test/codegen/fuse.go
+++ b/test/codegen/fuse.go
@@ -6,6 +6,8 @@
package codegen
+import "math"
+
// Notes:
// - these examples use channels to provide a source of
// unknown values that cannot be optimized away
@@ -196,6 +198,84 @@ func ui4d(c <-chan uint8) {
}
}
+// -------------------------------------//
+// merge NaN checks //
+// ------------------------------------ //
+
+func f64NaNOrPosInf(c <-chan float64) {
+ // This test assumes IsInf(x, 1) is implemented as x > MaxFloat rather than x == Inf(1).
+
+ // amd64:"JCS",-"JNE",-"JPS",-"JPC"
+ // riscv64:"FCLASSD",-"FLED",-"FLTD",-"FNED",-"FEQD"
+ for x := <-c; math.IsNaN(x) || math.IsInf(x, 1); x = <-c {
+ }
+}
+
+func f64NaNOrNegInf(c <-chan float64) {
+ // This test assumes IsInf(x, -1) is implemented as x < -MaxFloat rather than x == Inf(-1).
+
+ // amd64:"JCS",-"JNE",-"JPS",-"JPC"
+ // riscv64:"FCLASSD",-"FLED",-"FLTD",-"FNED",-"FEQD"
+ for x := <-c; math.IsNaN(x) || math.IsInf(x, -1); x = <-c {
+ }
+}
+
+func f64NaNOrLtOne(c <-chan float64) {
+ // amd64:"JCS",-"JNE",-"JPS",-"JPC"
+ // riscv64:"FLED",-"FLTD",-"FNED",-"FEQD"
+ for x := <-c; math.IsNaN(x) || x < 1; x = <-c {
+ }
+}
+
+func f64NaNOrLteOne(c <-chan float64) {
+ // amd64:"JLS",-"JNE",-"JPS",-"JPC"
+ // riscv64:"FLTD",-"FLED",-"FNED",-"FEQD"
+ for x := <-c; x <= 1 || math.IsNaN(x); x = <-c {
+ }
+}
+
+func f64NaNOrGtOne(c <-chan float64) {
+ // amd64:"JCS",-"JNE",-"JPS",-"JPC"
+ // riscv64:"FLED",-"FLTD",-"FNED",-"FEQD"
+ for x := <-c; math.IsNaN(x) || x > 1; x = <-c {
+ }
+}
+
+func f64NaNOrGteOne(c <-chan float64) {
+ // amd64:"JLS",-"JNE",-"JPS",-"JPC"
+ // riscv64:"FLTD",-"FLED",-"FNED",-"FEQD"
+ for x := <-c; x >= 1 || math.IsNaN(x); x = <-c {
+ }
+}
+
+func f32NaNOrLtOne(c <-chan float32) {
+ // amd64:"JCS",-"JNE",-"JPS",-"JPC"
+ // riscv64:"FLES",-"FLTS",-"FNES",-"FEQS"
+ for x := <-c; x < 1 || x != x; x = <-c {
+ }
+}
+
+func f32NaNOrLteOne(c <-chan float32) {
+ // amd64:"JLS",-"JNE",-"JPS",-"JPC"
+ // riscv64:"FLTS",-"FLES",-"FNES",-"FEQS"
+ for x := <-c; x != x || x <= 1; x = <-c {
+ }
+}
+
+func f32NaNOrGtOne(c <-chan float32) {
+ // amd64:"JCS",-"JNE",-"JPS",-"JPC"
+ // riscv64:"FLES",-"FLTS",-"FNES",-"FEQS"
+ for x := <-c; x > 1 || x != x; x = <-c {
+ }
+}
+
+func f32NaNOrGteOne(c <-chan float32) {
+ // amd64:"JLS",-"JNE",-"JPS",-"JPC"
+ // riscv64:"FLTS",-"FLES",-"FNES",-"FEQS"
+ for x := <-c; x != x || x >= 1; x = <-c {
+ }
+}
+
// ------------------------------------ //
// regressions //
// ------------------------------------ //