Skip to content

Commit 3005c64

Browse files
authored
fix: Backport math fixes from musl libc (AssemblyScript#1749)
1 parent 1789577 commit 3005c64

File tree

7 files changed

+156
-114
lines changed

7 files changed

+156
-114
lines changed

std/assembly/math.ts

Lines changed: 141 additions & 99 deletions
Large diffs are not rendered by default.

tests/compiler/std/array.optimized.wat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4202,7 +4202,7 @@
42024202
if
42034203
i32.const 0
42044204
i32.const 7264
4205-
i32.const 1399
4205+
i32.const 1417
42064206
i32.const 5
42074207
call $~lib/builtins/abort
42084208
unreachable

tests/compiler/std/array.untouched.wat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6622,7 +6622,7 @@
66226622
if
66236623
i32.const 0
66246624
i32.const 6240
6625-
i32.const 1399
6625+
i32.const 1417
66266626
i32.const 5
66276627
call $~lib/builtins/abort
66286628
unreachable

tests/compiler/std/math.optimized.wat

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,9 +1515,9 @@
15151515
block $__inlined_func$~lib/math/NativeMathf.acosh (result f32)
15161516
local.get $0
15171517
i32.reinterpret_f32
1518+
local.tee $3
15181519
i32.const 2147483647
15191520
i32.and
1520-
local.tee $3
15211521
i32.const 1073741824
15221522
i32.lt_u
15231523
if
@@ -4616,9 +4616,9 @@
46164616
f32.const -1
46174617
return
46184618
end
4619-
local.get $0
4620-
f32.const 88.7216796875
4621-
f32.gt
4619+
local.get $4
4620+
i32.const 1118925335
4621+
i32.gt_u
46224622
if
46234623
local.get $0
46244624
f32.const 1701411834604692317316873e14
@@ -8219,7 +8219,7 @@
82198219
if
82208220
i32.const 0
82218221
i32.const 3648
8222-
i32.const 1399
8222+
i32.const 1417
82238223
i32.const 5
82248224
call $~lib/builtins/abort
82258225
unreachable

tests/compiler/std/math.untouched.wat

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,7 @@
21192119
call $~lib/math/NativeMathf.log1p
21202120
return
21212121
end
2122-
local.get $2
2122+
local.get $1
21232123
i32.const 1065353216
21242124
i32.const 12
21252125
i32.const 23
@@ -6582,9 +6582,9 @@
65826582
f32.const -1
65836583
return
65846584
end
6585-
local.get $0
6586-
f32.const 88.7216796875
6587-
f32.gt
6585+
local.get $2
6586+
i32.const 1118925335
6587+
i32.gt_u
65886588
if
65896589
local.get $0
65906590
f32.const 1701411834604692317316873e14
@@ -11427,7 +11427,7 @@
1142711427
if
1142811428
i32.const 0
1142911429
i32.const 13376
11430-
i32.const 1399
11430+
i32.const 1417
1143111431
i32.const 5
1143211432
call $~lib/builtins/abort
1143311433
unreachable

tests/compiler/wasi/seed.optimized.wat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@
297297
(local $3 i32)
298298
i32.const 5
299299
local.set $2
300-
i32.const 1399
300+
i32.const 1417
301301
local.set $1
302302
i32.const 0
303303
i32.const 12
@@ -318,7 +318,7 @@
318318
local.tee $0
319319
i32.const 40
320320
i32.store8
321-
i32.const 1399
321+
i32.const 1417
322322
call $~lib/util/number/decimalCount32
323323
local.tee $3
324324
local.get $0

tests/compiler/wasi/seed.untouched.wat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@
610610
if
611611
i32.const 0
612612
i32.const 32
613-
i32.const 1399
613+
i32.const 1417
614614
i32.const 5
615615
call $~lib/wasi/index/abort
616616
unreachable

0 commit comments

Comments
 (0)