Skip to content

Commit 735f41b

Browse files
committed
Bug 1656226 - Implement the experimental opcodes. r=jseward
Implement some of the experimental SIMD opcodes that are supported by all of V8, LLVM, and Binaryen, for maximum compatibility with test content we might be exposed to. Most/all of these will probably make it into the spec, as they lead to substantial speedups in some programs, and they are deterministic. For spec and cpu mapping details, see: WebAssembly/simd#122 (pmax/pmin) WebAssembly/simd#232 (rounding) WebAssembly/simd#127 (dot product) WebAssembly/simd#237 (load zero) The wasm bytecode values used here come from the binaryen changes that are linked from those tickets, that's the best documentation right now. Current binaryen opcode mappings are here: https://github.com/WebAssembly/binaryen/blob/master/src/wasm-binary.h Also: Drive-by fix for signatures of vroundss and vroundsd, these are unary operations and should follow the conventions for these with src/dest arguments, not src0/src1/dest. Also: Drive-by fix to add variants of vmovss and vmovsd on x64 that take Operand source and FloatRegister destination. Differential Revision: https://phabricator.services.mozilla.com/D85982 UltraBlame original commit: 2d73a015caaa3e70c175172158a6548625dc6da3
1 parent e4b598a commit 735f41b

22 files changed

+5187
-85
lines changed

js/src/jit-test/lib/wasm-binary.js

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ F64Code
234234
0x7c
235235
;
236236
const
237+
V128Code
238+
=
239+
0x7b
240+
;
241+
const
237242
AnyFuncCode
238243
=
239244
0x70
@@ -296,6 +301,11 @@ SelectCode
296301
0x1b
297302
;
298303
const
304+
LocalGetCode
305+
=
306+
0x20
307+
;
308+
const
299309
I32Load
300310
=
301311
0x28
@@ -535,6 +545,105 @@ RefFuncCode
535545
=
536546
0xd2
537547
;
548+
/
549+
/
550+
SIMD
551+
opcodes
552+
const
553+
V128LoadCode
554+
=
555+
0x00
556+
;
557+
const
558+
V128StoreCode
559+
=
560+
0x0b
561+
;
562+
/
563+
/
564+
Experimental
565+
SIMD
566+
opcodes
567+
as
568+
of
569+
August
570+
2020
571+
.
572+
const
573+
I32x4DotSI16x8Code
574+
=
575+
0xba
576+
;
577+
const
578+
F32x4CeilCode
579+
=
580+
0xd8
581+
;
582+
const
583+
F32x4FloorCode
584+
=
585+
0xd9
586+
;
587+
const
588+
F32x4TruncCode
589+
=
590+
0xda
591+
;
592+
const
593+
F32x4NearestCode
594+
=
595+
0xdb
596+
;
597+
const
598+
F64x2CeilCode
599+
=
600+
0xdc
601+
;
602+
const
603+
F64x2FloorCode
604+
=
605+
0xdd
606+
;
607+
const
608+
F64x2TruncCode
609+
=
610+
0xde
611+
;
612+
const
613+
F64x2NearestCode
614+
=
615+
0xdf
616+
;
617+
const
618+
F32x4PMinCode
619+
=
620+
0xea
621+
;
622+
const
623+
F32x4PMaxCode
624+
=
625+
0xeb
626+
;
627+
const
628+
F64x2PMinCode
629+
=
630+
0xf6
631+
;
632+
const
633+
F64x2PMaxCode
634+
=
635+
0xf7
636+
;
637+
const
638+
V128Load32ZeroCode
639+
=
640+
0xfc
641+
;
642+
const
643+
V128Load64ZeroCode
644+
=
645+
0xfd
646+
;
538647
const
539648
FirstInvalidOpcode
540649
=
@@ -1925,6 +2034,18 @@ name
19252034
)
19262035
)
19272036
;
2037+
if
2038+
(
2039+
exp
2040+
.
2041+
hasOwnProperty
2042+
(
2043+
"
2044+
funcIndex
2045+
"
2046+
)
2047+
)
2048+
{
19282049
body
19292050
.
19302051
push
@@ -1954,6 +2075,60 @@ funcIndex
19542075
)
19552076
;
19562077
}
2078+
else
2079+
if
2080+
(
2081+
exp
2082+
.
2083+
hasOwnProperty
2084+
(
2085+
"
2086+
memIndex
2087+
"
2088+
)
2089+
)
2090+
{
2091+
body
2092+
.
2093+
push
2094+
(
2095+
.
2096+
.
2097+
.
2098+
varU32
2099+
(
2100+
MemoryCode
2101+
)
2102+
)
2103+
;
2104+
body
2105+
.
2106+
push
2107+
(
2108+
.
2109+
.
2110+
.
2111+
varU32
2112+
(
2113+
exp
2114+
.
2115+
memIndex
2116+
)
2117+
)
2118+
;
2119+
}
2120+
else
2121+
{
2122+
throw
2123+
"
2124+
Bad
2125+
export
2126+
"
2127+
+
2128+
exp
2129+
;
2130+
}
2131+
}
19572132
return
19582133
{
19592134
name

js/src/jit-test/tests/wasm/binary.js

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4078,7 +4078,6 @@ reservedSimd
40784078
0xb2
40794079
0xb3
40804080
0xb4
4081-
0xba
40824081
0xbb
40834082
0xbc
40844083
0xbd
@@ -4101,6 +4100,35 @@ reservedSimd
41014100
0xd4
41024101
0xd6
41034102
0xd7
4103+
0xee
4104+
0xfe
4105+
0xff
4106+
/
4107+
/
4108+
These
4109+
are
4110+
experimental
4111+
opcodes
4112+
currently
4113+
we
4114+
support
4115+
them
4116+
but
4117+
they
4118+
/
4119+
/
4120+
may
4121+
disappear
4122+
again
4123+
.
4124+
/
4125+
/
4126+
0xba
4127+
;
4128+
dot
4129+
product
4130+
/
4131+
/
41044132
0xd8
41054133
0xd9
41064134
0xda
@@ -4109,15 +4137,27 @@ reservedSimd
41094137
0xdd
41104138
0xde
41114139
0xdf
4140+
;
4141+
rounding
4142+
/
4143+
/
41124144
0xea
41134145
0xeb
4114-
0xee
41154146
0xf6
41164147
0xf7
4148+
;
4149+
pseudo
4150+
min
4151+
/
4152+
max
4153+
/
4154+
/
41174155
0xfc
41184156
0xfd
4119-
0xfe
4120-
0xff
4157+
;
4158+
load
4159+
+
4160+
zero
41214161
]
41224162
;
41234163
for

0 commit comments

Comments
 (0)