diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/ion/compareAll.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | js/src/jit-test/tests/ion/compareAll.js | 279 |
1 files changed, 279 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/compareAll.js b/js/src/jit-test/tests/ion/compareAll.js new file mode 100644 index 0000000000..58d82b4a43 --- /dev/null +++ b/js/src/jit-test/tests/ion/compareAll.js @@ -0,0 +1,279 @@ +load(libdir + 'array-compare.js'); + +function compareIAndSet(v) { + var res = 0; + var c; + var i = 0; + c = (v > 1); + res |= (c << i); + i++; + c = (v >= 2); + res |= (c << i); + i++; + c = (v < 3); + res |= (c << i); + i++; + c = (v <= 4); + res |= (c << i); + i++; + c = (v == 5); + res |= (c << i); + i++; + c = (v != 6); + res |= (c << i); + i++; + c = (v === 7); + res |= (c << i); + i++; + c = (v !== 8); + res |= (c << i); + i++; + return res; +} + +function compareIAndBranch(v) { + var res = 0; + var c = 1; + var i = 0; + if (v > 1) + res |= (c << i); + i++; + if (v >= 2) + res |= (c << i); + i++; + if (v < 3) + res |= (c << i); + i++; + if (v <= 4) + res |= (c << i); + i++; + if (v == 5) + res |= (c << i); + i++; + if (v != 6) + res |= (c << i); + i++; + if (v === 7) + res |= (c << i); + i++; + if (v !== 8) + res |= (c << i); + i++; + if (v) + res |= (c << i); + i++; + return res; +} + +function compareDAndSet(v) { + var res = 0; + var c; + var i = 0; + c = (v > 1.5); + res |= (c << i); + i++; + c = (v >= 2.5); + res |= (c << i); + i++; + c = (v < 3.5); + res |= (c << i); + i++; + c = (v <= 4.5); + res |= (c << i); + i++; + c = (v == 5.5); + res |= (c << i); + i++; + c = (v != 6.5); + res |= (c << i); + i++; + c = (v === 7.5); + res |= (c << i); + i++; + c = (v !== 8.5); + res |= (c << i); + i++; + c = (v !== 0.0); + res |= (c << i); + i++; + return res; +} + +function compareDAndBranch(v) { + var res = 0; + var c = 1; + var i = 0; + if (v > 1.5) + res |= (c << i); + i++; + if (v >= 2.5) + res |= (c << i); + i++; + if (v < 3.5) + res |= (c << i); + i++; + if (v <= 4.5) + res |= (c << i); + i++; + if (v == 5.5) + res |= (c << i); + i++; + if (v != 6.5) + res |= (c << i); + i++; + if (v === 7.5) + res |= (c << i); + i++; + if (v !== 8.5) + res |= (c << i); + i++; + if (v) + res |= (c << i); + i++; + return res; +} + +function compareSAndSet(v) { + var res = 0; + var c; + var i = 0; + c = (v > "a"); + res |= (c << i); + i++; + c = (v >= "b"); + res |= (c << i); + i++; + c = (v < "c"); + res |= (c << i); + i++; + c = (v <= "d"); + res |= (c << i); + i++; + c = (v == "e"); + res |= (c << i); + i++; + c = (v != "f"); + res |= (c << i); + i++; + c = (v === "g"); + res |= (c << i); + i++; + c = (v !== "h"); + res |= (c << i); + i++; + return res; +} + +function compareSAndBranch(v) { + var res = 0; + var c = 1; + var i = 0; + if (v > "a") + res |= (c << i); + i++; + if (v >= "b") + res |= (c << i); + i++; + if (v < "c") + res |= (c << i); + i++; + if (v <= "d") + res |= (c << i); + i++; + if (v == "e") + res |= (c << i); + i++; + if (v != "f") + res |= (c << i); + i++; + if (v === "g") + res |= (c << i); + i++; + if (v !== "h") + res |= (c << i); + i++; + if (v) + res |= (c << i); + i++; + return res; +} + +var expected = [ + // compareIAndSet + 172, 175, 171, 171, 179, 131, 227, 35, + // compareIAndBranch + 428, 431, 427, 427, 435, 387, 483, 291, + // compareDAndSet + 428, 428, 431, 427, 427, 435, 387, 483, 291, 416, + // compareDAndBranch + 428, 428, 431, 427, 427, 435, 387, 483, 291, 160, 172, + // compareSAndSet + 172, 175, 171, 171, 179, 131, 227, 35, 172, + // compareSAndBranch + 428, 431, 427, 427, 435, 387, 483, 291, 172 +]; + +var result = [ + compareIAndSet(1), + compareIAndSet(2), + compareIAndSet(3), + compareIAndSet(4), + compareIAndSet(5), + compareIAndSet(6), + compareIAndSet(7), + compareIAndSet(8), + + compareIAndBranch(1), + compareIAndBranch(2), + compareIAndBranch(3), + compareIAndBranch(4), + compareIAndBranch(5), + compareIAndBranch(6), + compareIAndBranch(7), + compareIAndBranch(8), + + compareDAndSet(0.5), + compareDAndSet(1.5), + compareDAndSet(2.5), + compareDAndSet(3.5), + compareDAndSet(4.5), + compareDAndSet(5.5), + compareDAndSet(6.5), + compareDAndSet(7.5), + compareDAndSet(8.5), + compareDAndSet(NaN), + + compareDAndBranch(0.5), + compareDAndBranch(1.5), + compareDAndBranch(2.5), + compareDAndBranch(3.5), + compareDAndBranch(4.5), + compareDAndBranch(5.5), + compareDAndBranch(6.5), + compareDAndBranch(7.5), + compareDAndBranch(8.5), + compareDAndBranch(NaN), + compareDAndBranch(0.0), + + compareSAndSet("a"), + compareSAndSet("b"), + compareSAndSet("c"), + compareSAndSet("d"), + compareSAndSet("e"), + compareSAndSet("f"), + compareSAndSet("g"), + compareSAndSet("h"), + compareSAndSet(""), + + compareSAndBranch("a"), + compareSAndBranch("b"), + compareSAndBranch("c"), + compareSAndBranch("d"), + compareSAndBranch("e"), + compareSAndBranch("f"), + compareSAndBranch("g"), + compareSAndBranch("h"), + compareSAndBranch("") +]; + +assertEq(arraysEqual(result, expected), true); |