-
Notifications
You must be signed in to change notification settings - Fork 15
/
simdAlt.js
136 lines (117 loc) · 3.8 KB
/
simdAlt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//module SIMD -- with static methods for operations
export class Float32x4 {
constructor (v1, v2, v3, v4) { ...}
//factory methods
static splat(v) {return new this(v, v, v, v);
static fromFloat64x2(t) {...}
static fromInt32x4(t) {...}
static fromFloat64x2Bits(t) {...}
static fromInt32x4Bits(t) {...}
static fromInt16x8Bits(t) {...}
static fromInt8x16Bits(t) {...}
//static predicates
static check(v) {[[hasTag]](v, this) ? v : throw new TypeError}
//static accessor function
static extractLane(t, i) {...}
static store(array, index, value) {...}
static store1(array, index, value) {...}
static store2(array, index, value) {...}
static store3(array, index, value) {...}
//computational factories
static abs(t) {...}
static neg(t) {...}
static add(a, b) {...}
static sub(a, b) {...}
static mul(a, b) {...}
static div(a, b) {...}
static clamp(t, lowerLimit, upperLimit) {...}
static min(a, b) {...}
static max(a, b) {...}
static minNum(a, b) {...}
static maxNum(a, b) {...}
static reciprocalApproximation(t) {...}
static reciprocalSqrtApproximation(t) {...}
static sqrt(t) {...}
static swizzle(t, x, y, z, w) {...}
static shuffle(a, b, x, y, z, w) {...}
static and(a, b) {...}
static or(a, b) {...}
static xor(a, b) {...}
static not(a) {...}
//Boolean vector computational Factories (all return Int32x4)
static lessThan(a, b) {...}
static lessThanOrEqual(a, b) {...}
static equal(a, b) {...}
static notEqual(a, b) {...}
static greaterThan(a, b) {...}
static greaterThanOrEqual(a, b) {...}
//selection Factories
static select(laneSelector, trueValues, falseValues) {...}
static bitSelect(bitSelectionMask, trueValues, falseValues) {...}
//from TypedArray factories
static load(array, index) {...}
static load1(array, index) {...}
static load2(array, index) {...}
static load3(array, index) {...}
//prototype methods
get [Symbol.toStringTag]() {return "Float32x4"}
}
//--------------------------------------------------------------
//module SIMD -- with prototype methods for operations
export class Float32x4 {
constructor (v1, v2, v3, v4) { ...}
//factory methods
static splat(v) {return new this(v, v, v, v);
static fromFloat64x2(t) {...}
static fromInt32x4(t) {...}
static fromFloat64x2Bits(t) {...}
static fromInt32x4Bits(t) {...}
static fromInt16x8Bits(t) {...}
static fromInt8x16Bits(t) {...}
//from TypedArray factories
static load(array, index) {...}
static load1(array, index) {...}
static load2(array, index) {...}
static load3(array, index) {...}
//selection Factories
static select(laneSelector, trueValues, falseValues) {...}
static bitSelect(bitSelectionMask, trueValues, falseValues) {...}
// predicates
static isFloat32x4() {[[hasTag]](this, "Float32x4Tag") ? v : throw new TypeError}
// accessor methods
extractLane(i) {...}
store(array, index) {...}
store1(array, index) {...}
store2(array, index) {...}
store3(array, index) {...}
//computational operations
abs() {...}
neg() {...}
add(b) {...}
sub(b) {...}
mul(b) {...}
div(b) {...}
clamp(lowerLimit, upperLimit) {...}
min(b) {...}
max(b) {...}
minNum(b) {...}
maxNum(b) {...}
reciprocalApproximation() {...}
reciprocalSqrtApproximation() {...}
sqrt() {...}
swizzle(x, y, z, w) {...}
shuffle(b, x, y, z, w) {...}
and(b) {...}
or(b) {...}
xor(b) {...}
not() {...}
//Boolean comparisions (all return Int32x4)
lessThan(b) {...}
lessThanOrEqualb) {...}
equal(b) {...}
notEqual(b) {...}
greaterThan(b) {...}
greaterThanOrEqual(b) {...}
//other methods
get [Symbol.toStringTag]() {return "Float32x4"}
}