summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/optimize-instructions_all-features.txt178
-rw-r--r--test/passes/optimize-instructions_all-features.wast118
-rw-r--r--test/wasm2js/conversions-modified.2asm.js.opt4
-rw-r--r--test/wasm2js/float-ops.2asm.js.opt4
4 files changed, 297 insertions, 7 deletions
diff --git a/test/passes/optimize-instructions_all-features.txt b/test/passes/optimize-instructions_all-features.txt
index 64b2d787b..93f4c3087 100644
--- a/test/passes/optimize-instructions_all-features.txt
+++ b/test/passes/optimize-instructions_all-features.txt
@@ -16,7 +16,9 @@
(type $i32_i32_i32_f64_=>_none (func (param i32 i32 i32 f64)))
(type $i32_i32_f64_f64_=>_none (func (param i32 i32 f64 f64)))
(type $i32_i64_f64_i32_=>_none (func (param i32 i64 f64 i32)))
+ (type $f32_=>_none (func (param f32)))
(type $f32_f64_=>_none (func (param f32 f64)))
+ (type $f64_=>_none (func (param f64)))
(type $none_=>_f64 (func (result f64)))
(memory $0 0)
(export "load-off-2" (func $load-off-2))
@@ -2728,6 +2730,178 @@
)
(unreachable)
)
+ (func $fdiv-32-power-2 (param $x f32)
+ (drop
+ (f32.mul
+ (local.get $x)
+ (f32.const 0.5)
+ )
+ )
+ (drop
+ (f32.mul
+ (local.get $x)
+ (f32.const -0.5)
+ )
+ )
+ (drop
+ (f32.mul
+ (local.get $x)
+ (f32.const 2.3283064365386963e-10)
+ )
+ )
+ (drop
+ (f32.mul
+ (local.get $x)
+ (f32.const 5.421010862427522e-20)
+ )
+ )
+ (drop
+ (f32.mul
+ (local.get $x)
+ (f32.const 8507059173023461586584365e13)
+ )
+ )
+ (drop
+ (f32.mul
+ (local.get $x)
+ (f32.const 1.1754943508222875e-38)
+ )
+ )
+ (drop
+ (f32.mul
+ (local.get $x)
+ (f32.const -8507059173023461586584365e13)
+ )
+ )
+ (drop
+ (f32.mul
+ (local.get $x)
+ (f32.const -1.1754943508222875e-38)
+ )
+ )
+ (drop
+ (f32.div
+ (local.get $x)
+ (f32.const 5.877471754111438e-39)
+ )
+ )
+ (drop
+ (f32.div
+ (local.get $x)
+ (f32.const 5.877471754111438e-39)
+ )
+ )
+ (drop
+ (f32.div
+ (local.get $x)
+ (f32.const 0)
+ )
+ )
+ (drop
+ (f32.div
+ (local.get $x)
+ (f32.const nan:0x400000)
+ )
+ )
+ (drop
+ (f32.div
+ (local.get $x)
+ (f32.const inf)
+ )
+ )
+ (drop
+ (f32.div
+ (local.get $x)
+ (f32.const -inf)
+ )
+ )
+ )
+ (func $fdiv-64-power-2 (param $x f64)
+ (drop
+ (f64.mul
+ (local.get $x)
+ (f64.const 0.5)
+ )
+ )
+ (drop
+ (f64.mul
+ (local.get $x)
+ (f64.const -0.5)
+ )
+ )
+ (drop
+ (f64.mul
+ (local.get $x)
+ (f64.const 2.3283064365386963e-10)
+ )
+ )
+ (drop
+ (f64.mul
+ (local.get $x)
+ (f64.const 5.421010862427522e-20)
+ )
+ )
+ (drop
+ (f64.mul
+ (local.get $x)
+ (f64.const 4494232837155789769323262e283)
+ )
+ )
+ (drop
+ (f64.mul
+ (local.get $x)
+ (f64.const 2.2250738585072014e-308)
+ )
+ )
+ (drop
+ (f64.mul
+ (local.get $x)
+ (f64.const -4494232837155789769323262e283)
+ )
+ )
+ (drop
+ (f64.mul
+ (local.get $x)
+ (f64.const -2.2250738585072014e-308)
+ )
+ )
+ (drop
+ (f64.div
+ (local.get $x)
+ (f64.const 1.1125369292536007e-308)
+ )
+ )
+ (drop
+ (f64.div
+ (local.get $x)
+ (f64.const 8988465674311579538646525e283)
+ )
+ )
+ (drop
+ (f64.div
+ (local.get $x)
+ (f64.const 0)
+ )
+ )
+ (drop
+ (f64.div
+ (local.get $x)
+ (f64.const nan:0x8000000000000)
+ )
+ )
+ (drop
+ (f64.div
+ (local.get $x)
+ (f64.const inf)
+ )
+ )
+ (drop
+ (f64.div
+ (local.get $x)
+ (f64.const -inf)
+ )
+ )
+ )
(func $srem-by-const (param $x i32) (param $y i64)
(drop
(i32.const 0)
@@ -2995,13 +3169,13 @@
(local.get $x64)
)
(drop
- (f32.div
+ (f32.mul
(local.get $y32)
(f32.const 1)
)
)
(drop
- (f64.div
+ (f64.mul
(local.get $y64)
(f64.const 1)
)
diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast
index e84778fde..80f440a59 100644
--- a/test/passes/optimize-instructions_all-features.wast
+++ b/test/passes/optimize-instructions_all-features.wast
@@ -3093,6 +3093,122 @@
)
(unreachable)
)
+ (func $fdiv-32-power-2 (param $x f32)
+ (drop (f32.div
+ (local.get $x)
+ (f32.const 2)
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const -2)
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const 4294967296)
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const 18446744073709551616)
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const 0x1p-126)
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const 0x1p+126)
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const -0x1p-126)
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const -0x1p+126)
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const 0x1p-127) ;; skip
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const 0x1p-127) ;; skip
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const 0) ;; skip
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const nan) ;; skip
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const inf) ;; skip
+ ))
+ (drop (f32.div
+ (local.get $x)
+ (f32.const -inf) ;; skip
+ ))
+ )
+ (func $fdiv-64-power-2 (param $x f64)
+ (drop (f64.div
+ (local.get $x)
+ (f64.const 2)
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const -2)
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const 4294967296)
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const 18446744073709551616)
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const 0x1p-1022)
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const 0x1p+1022)
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const -0x1p-1022)
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const -0x1p+1022)
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const 0x1p-1023) ;; skip
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const 0x1p+1023) ;; skip
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const 0) ;; skip
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const nan) ;; skip
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const inf) ;; skip
+ ))
+ (drop (f64.div
+ (local.get $x)
+ (f64.const -inf) ;; skip
+ ))
+ )
(func $srem-by-const (param $x i32) (param $y i64)
;; (signed)x % 1
(drop (i32.rem_s
@@ -4908,7 +5024,7 @@
(local.get $x)
(local.get $y)
)
- ))
+ ))
;; x | (y | x) where x and y cannot be reordered - skip
(drop
(i32.or
diff --git a/test/wasm2js/conversions-modified.2asm.js.opt b/test/wasm2js/conversions-modified.2asm.js.opt
index befce2489..072a3bbc6 100644
--- a/test/wasm2js/conversions-modified.2asm.js.opt
+++ b/test/wasm2js/conversions-modified.2asm.js.opt
@@ -67,13 +67,13 @@ function asmFunc(global, env) {
function $7($0) {
$0 = Math_fround($0);
- i64toi32_i32$HIGH_BITS = Math_fround(Math_abs($0)) >= Math_fround(1.0) ? ($0 > Math_fround(0.0) ? ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 / Math_fround(4294967296.0)))), Math_fround(4294967296.0))) >>> 0 : ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0) : 0;
+ i64toi32_i32$HIGH_BITS = Math_fround(Math_abs($0)) >= Math_fround(1.0) ? ($0 > Math_fround(0.0) ? ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 * Math_fround(2.3283064365386963e-10)))), Math_fround(4294967296.0))) >>> 0 : ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) * Math_fround(2.3283064365386963e-10)))) >>> 0) : 0;
return ~~$0 >>> 0 | 0;
}
function $9($0) {
$0 = +$0;
- i64toi32_i32$HIGH_BITS = Math_abs($0) >= 1.0 ? ($0 > 0.0 ? ~~Math_min(Math_floor($0 / 4294967296.0), 4294967295.0) >>> 0 : ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0) : 0;
+ i64toi32_i32$HIGH_BITS = Math_abs($0) >= 1.0 ? ($0 > 0.0 ? ~~Math_min(Math_floor($0 * 2.3283064365386963e-10), 4294967295.0) >>> 0 : ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) * 2.3283064365386963e-10) >>> 0) : 0;
return ~~$0 >>> 0 | 0;
}
diff --git a/test/wasm2js/float-ops.2asm.js.opt b/test/wasm2js/float-ops.2asm.js.opt
index 1635dbc9a..fd13fe56d 100644
--- a/test/wasm2js/float-ops.2asm.js.opt
+++ b/test/wasm2js/float-ops.2asm.js.opt
@@ -238,12 +238,12 @@ function asmFunc(global, env) {
function $47($0) {
$0 = Math_fround($0);
- return !(~~$0 >>> 0 | (Math_fround(Math_abs($0)) >= Math_fround(1.0) ? ($0 > Math_fround(0.0) ? ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 / Math_fround(4294967296.0)))), Math_fround(4294967296.0))) >>> 0 : ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0) : 0)) | 0;
+ return !(~~$0 >>> 0 | (Math_fround(Math_abs($0)) >= Math_fround(1.0) ? ($0 > Math_fround(0.0) ? ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 * Math_fround(2.3283064365386963e-10)))), Math_fround(4294967296.0))) >>> 0 : ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) * Math_fround(2.3283064365386963e-10)))) >>> 0) : 0)) | 0;
}
function $48($0) {
$0 = +$0;
- return !(~~$0 >>> 0 | (Math_abs($0) >= 1.0 ? ($0 > 0.0 ? ~~Math_min(Math_floor($0 / 4294967296.0), 4294967295.0) >>> 0 : ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0) : 0)) | 0;
+ return !(~~$0 >>> 0 | (Math_abs($0) >= 1.0 ? ($0 > 0.0 ? ~~Math_min(Math_floor($0 * 2.3283064365386963e-10), 4294967295.0) >>> 0 : ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) * 2.3283064365386963e-10) >>> 0) : 0)) | 0;
}
function legalstub$43($0, $1_1) {