summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/SIMD/inline-missing-arguments.js
blob: 5ef91d072a38b9b79739d550cb661f140f212f82 (plain)
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
load(libdir + 'simd.js');

setJitCompilerOption("ion.warmup.trigger", 50);

function test(i) {
    assertEqX4(SIMD.Int32x4(),              [0, 0, 0, 0]);
    assertEqX4(SIMD.Int32x4(i),             [i, 0, 0, 0]);
    assertEqX4(SIMD.Int32x4(i, 1),          [i, 1, 0, 0]);
    assertEqX4(SIMD.Int32x4(i, 1, 2),       [i, 1, 2, 0]);
    assertEqX4(SIMD.Int32x4(i, 1, 2, 3),    [i, 1, 2, 3]);
    assertEqX4(SIMD.Int32x4(i, 1, 2, 3, 4), [i, 1, 2, 3]);

    assertEqVecArr(SIMD.Int16x8(),              [0, 0, 0, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int16x8(i),             [i, 0, 0, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int16x8(i, 1),          [i, 1, 0, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int16x8(i, 1, 2),       [i, 1, 2, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int16x8(i, 1, 2, 3),    [i, 1, 2, 3, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int16x8(i, 1, 2, 3, 4), [i, 1, 2, 3, 4, 0, 0, 0]);
    assertEqVecArr(SIMD.Int16x8(i, 1, 2, 3, 4, 5, 6),
                               [i, 1, 2, 3, 4, 5, 6, 0]);
    j = i & 32
    assertEqVecArr(SIMD.Int8x16(),              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int8x16(j),             [j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int8x16(j, 1),          [j, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int8x16(j, 1, 2),       [j, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int8x16(j, 1, 2, 3),    [j, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int8x16(j, 1, 2, 3, 4), [j, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int8x16(j, 1, 2, 3, 4, 5, 6),
                               [j, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
    assertEqVecArr(SIMD.Int8x16(j, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12),
                               [j, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 0, 0]);

    assertEqX4(SIMD.Float32x4(),                [NaN, NaN, NaN, NaN]);
    assertEqX4(SIMD.Float32x4(i),               [i,   NaN, NaN, NaN]);
    assertEqX4(SIMD.Float32x4(i, 1),            [i,   1,   NaN, NaN]);
    assertEqX4(SIMD.Float32x4(i, 1, 2),         [i,   1,   2,   NaN]);
    assertEqX4(SIMD.Float32x4(i, 1, 2, 3),      [i,   1,   2,   3  ]);
    assertEqX4(SIMD.Float32x4(i, 1, 2, 3, 4),   [i,   1,   2,   3  ]);

    var b = i % 2 > 0 ;
    assertEqX4(SIMD.Bool32x4(),                           [false, false, false, false]);
    assertEqX4(SIMD.Bool32x4(b),                          [b,     false, false, false]);
    assertEqX4(SIMD.Bool32x4(b, true),                    [b,     true,  false, false]);
    assertEqX4(SIMD.Bool32x4(b, false, true),             [b,     false, true,  false]);
    assertEqX4(SIMD.Bool32x4(b, false, true, true),       [b,     false, true,  true ]);
    assertEqX4(SIMD.Bool32x4(b, false, true, true, true), [b,     false, true,  true ]);

    assertEqVecArr(SIMD.Bool16x8(),
                                [false, false, false, false, false, false, false, false]);
    assertEqVecArr(SIMD.Bool16x8(b),
                                [b,     false, false, false, false, false, false, false]);
    assertEqVecArr(SIMD.Bool16x8(b,     true),
                                [b,     true,  false, false, false, false, false, false]);
    assertEqVecArr(SIMD.Bool16x8(b,     false, true),
                                [b,     false, true,  false, false, false, false, false]);
    assertEqVecArr(SIMD.Bool16x8(b,     false, true,  true),
                                [b,     false, true,  true,  false, false, false, false]);
    assertEqVecArr(SIMD.Bool16x8(b,     false, true,  true,  true),
                                [b,     false, true,  true,  true,  false, false, false]);
    assertEqVecArr(SIMD.Bool16x8(b,     false, true,  true,  true,  true),
                                [b,     false, true,  true,  true,  true,  false, false]);

    assertEqVecArr(SIMD.Bool8x16(),
                                [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false]);
    assertEqVecArr(SIMD.Bool8x16(b),
                                [b,     false, false, false, false, false, false, false, false, false, false, false, false, false, false, false]);
    assertEqVecArr(SIMD.Bool8x16(b,     true),
                                [b,     true,  false, false, false, false, false, false, false, false, false, false, false, false, false, false]);
    assertEqVecArr(SIMD.Bool8x16(b,     false, true),
                                [b,     false, true,  false, false, false, false, false, false, false, false, false, false, false, false, false]);
    assertEqVecArr(SIMD.Bool8x16(b,     false, true,  true),
                                [b,     false, true,  true,  false, false, false, false, false, false, false, false, false, false, false, false]);
    assertEqVecArr(SIMD.Bool8x16(b,     false, true,  true,  true),
                                [b,     false, true,  true,  true,  false, false, false, false, false, false, false, false, false, false, false]);
    assertEqVecArr(SIMD.Bool8x16(b,     false, true,  true,  true,  true,  false, true,  true,  true),
                                [b,     false, true,  true,  true,  true,  false, true,  true,  true,  false, false, false, false, false, false]);
}

for(var i=0; i<300; i++) {
    test(i);
}