Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more
  • Loading branch information
MaxGraey committed Oct 26, 2020
commit 7787cf3ff298a9cfdd71479d660ae42faef4dd72
4 changes: 2 additions & 2 deletions std/assembly/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ export namespace NativeMath {
}
var ux1 = ux << 1;
if (ux1 <= uy1) {
return ux1 == uy1 ? 0 * x : x;
return x * f64(ux1 != uy1);
}
if (!ex) {
ex -= builtin_clz<i64>(ux << 12);
Expand Down Expand Up @@ -2890,7 +2890,7 @@ export namespace NativeMathf {
}
var ux1 = ux << 1;
if (ux1 <= uy1) {
return ux1 == uy1 ? 0 * x : x;
return x * f32(ux1 != uy1);
}
if (!ex) {
ex -= builtin_clz<u32>(ux << 9);
Expand Down
24 changes: 8 additions & 16 deletions tests/compiler/binary.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -1288,16 +1288,12 @@
local.get $7
i32.le_u
if
local.get $0
local.get $9
local.get $7
i32.eq
if (result f32)
f32.const 0
local.get $0
f32.mul
else
local.get $0
end
i32.ne
f32.convert_i32_u
f32.mul
return
end
local.get $4
Expand Down Expand Up @@ -2161,16 +2157,12 @@
local.get $7
i64.le_u
if
local.get $0
local.get $9
local.get $7
i64.eq
if (result f64)
f64.const 0
local.get $0
f64.mul
else
local.get $0
end
i64.ne
f64.convert_i32_u
f64.mul
return
end
local.get $4
Expand Down
16 changes: 6 additions & 10 deletions tests/compiler/std/math.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -6526,14 +6526,12 @@
local.get $6
i64.le_u
if
local.get $0
f64.const 0
f64.mul
local.get $0
local.get $6
local.get $8
i64.eq
select
i64.ne
f64.convert_i32_u
f64.mul
return
end
local.get $4
Expand Down Expand Up @@ -6753,14 +6751,12 @@
local.get $6
i32.le_u
if
local.get $0
f32.const 0
f32.mul
local.get $0
local.get $6
local.get $8
i32.eq
select
i32.ne
f32.convert_i32_u
f32.mul
return
end
local.get $4
Expand Down
24 changes: 8 additions & 16 deletions tests/compiler/std/math.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -9227,16 +9227,12 @@
local.get $7
i64.le_u
if
local.get $0
local.get $9
local.get $7
i64.eq
if (result f64)
f64.const 0
local.get $0
f64.mul
else
local.get $0
end
i64.ne
f64.convert_i32_u
f64.mul
return
end
local.get $4
Expand Down Expand Up @@ -9516,16 +9512,12 @@
local.get $7
i32.le_u
if
local.get $0
local.get $9
local.get $7
i32.eq
if (result f32)
f32.const 0
local.get $0
f32.mul
else
local.get $0
end
i32.ne
f32.convert_i32_u
f32.mul
return
end
local.get $4
Expand Down
16 changes: 6 additions & 10 deletions tests/compiler/std/mod.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,12 @@
local.get $6
i64.le_u
if
local.get $0
f64.const 0
f64.mul
local.get $0
local.get $6
local.get $8
i64.eq
select
i64.ne
f64.convert_i32_u
f64.mul
return
end
local.get $4
Expand Down Expand Up @@ -336,14 +334,12 @@
local.get $6
i32.le_u
if
local.get $0
f32.const 0
f32.mul
local.get $0
local.get $6
local.get $8
i32.eq
select
i32.ne
f32.convert_i32_u
f32.mul
return
end
local.get $4
Expand Down
24 changes: 8 additions & 16 deletions tests/compiler/std/mod.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,12 @@
local.get $7
i64.le_u
if
local.get $0
local.get $9
local.get $7
i64.eq
if (result f64)
f64.const 0
local.get $0
f64.mul
else
local.get $0
end
i64.ne
f64.convert_i32_u
f64.mul
return
end
local.get $4
Expand Down Expand Up @@ -414,16 +410,12 @@
local.get $7
i32.le_u
if
local.get $0
local.get $9
local.get $7
i32.eq
if (result f32)
f32.const 0
local.get $0
f32.mul
else
local.get $0
end
i32.ne
f32.convert_i32_u
f32.mul
return
end
local.get $4
Expand Down
16 changes: 6 additions & 10 deletions tests/compiler/std/typedarray.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -9623,14 +9623,12 @@
i32.const -2147483648
i32.le_u
if
local.get $0
f32.const 0
f32.mul
local.get $0
local.get $3
i32.const -2147483648
i32.eq
select
i32.ne
f32.convert_i32_u
f32.mul
return
end
local.get $2
Expand Down Expand Up @@ -9852,14 +9850,12 @@
i64.const -9223372036854775808
i64.le_u
if
local.get $0
f64.const 0
f64.mul
local.get $0
local.get $3
i64.const -9223372036854775808
i64.eq
select
i64.ne
f64.convert_i32_u
f64.mul
return
end
local.get $2
Expand Down
24 changes: 8 additions & 16 deletions tests/compiler/std/typedarray.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -19101,16 +19101,12 @@
local.get $7
i32.le_u
if
local.get $0
local.get $9
local.get $7
i32.eq
if (result f32)
f32.const 0
local.get $0
f32.mul
else
local.get $0
end
i32.ne
f32.convert_i32_u
f32.mul
return
end
local.get $4
Expand Down Expand Up @@ -19526,16 +19522,12 @@
local.get $7
i64.le_u
if
local.get $0
local.get $9
local.get $7
i64.eq
if (result f64)
f64.const 0
local.get $0
f64.mul
else
local.get $0
end
i64.ne
f64.convert_i32_u
f64.mul
return
end
local.get $4
Expand Down