1// Copyright 2018 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5#include "textflag.h"
6
7TEXT runtime·wasmDiv(SB), NOSPLIT, $0-0
8	Get R0
9	I64Const $-0x8000000000000000
10	I64Eq
11	If
12		Get R1
13		I64Const $-1
14		I64Eq
15		If
16			I64Const $-0x8000000000000000
17			Return
18		End
19	End
20	Get R0
21	Get R1
22	I64DivS
23	Return
24
25TEXT runtime·wasmTruncS(SB), NOSPLIT, $0-0
26	Get R0
27	Get R0
28	F64Ne // NaN
29	If
30		I64Const $0x8000000000000000
31		Return
32	End
33
34	Get R0
35	F64Const $0x7ffffffffffffc00p0 // Maximum truncated representation of 0x7fffffffffffffff
36	F64Gt
37	If
38		I64Const $0x8000000000000000
39		Return
40	End
41
42	Get R0
43	F64Const $-0x7ffffffffffffc00p0 // Minimum truncated representation of -0x8000000000000000
44	F64Lt
45	If
46		I64Const $0x8000000000000000
47		Return
48	End
49
50	Get R0
51	I64TruncF64S
52	Return
53
54TEXT runtime·wasmTruncU(SB), NOSPLIT, $0-0
55	Get R0
56	Get R0
57	F64Ne // NaN
58	If
59		I64Const $0x8000000000000000
60		Return
61	End
62
63	Get R0
64	F64Const $0xfffffffffffff800p0 // Maximum truncated representation of 0xffffffffffffffff
65	F64Gt
66	If
67		I64Const $0x8000000000000000
68		Return
69	End
70
71	Get R0
72	F64Const $0.
73	F64Lt
74	If
75		I64Const $0x8000000000000000
76		Return
77	End
78
79	Get R0
80	I64TruncF64U
81	Return
82
83TEXT runtime·exitThread(SB), NOSPLIT, $0-0
84	UNDEF
85
86TEXT runtime·osyield(SB), NOSPLIT, $0-0
87	UNDEF
88
89TEXT runtime·growMemory(SB), NOSPLIT, $0
90	Get SP
91	I32Load pages+0(FP)
92	GrowMemory
93	I32Store ret+8(FP)
94	RET
95