summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/asm.js/testX86ByteStore.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/asm.js/testX86ByteStore.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/asm.js/testX86ByteStore.js')
-rw-r--r--js/src/jit-test/tests/asm.js/testX86ByteStore.js77
1 files changed, 77 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/asm.js/testX86ByteStore.js b/js/src/jit-test/tests/asm.js/testX86ByteStore.js
new file mode 100644
index 000000000..05556a5d9
--- /dev/null
+++ b/js/src/jit-test/tests/asm.js/testX86ByteStore.js
@@ -0,0 +1,77 @@
+load(libdir + "asm.js");
+
+var body =
+' "use asm";\
+ var i8=new global.Int8Array(buffer);\
+ function g(i,j,k) {\
+ i=i|0;\
+ j=j|0;\
+ k=k|0;\
+ var a=0,b=0,c=0,d=0,e=0,f=0;\
+ a=(i+j)|0;\
+ b=(k+j)|0;\
+ c=(i+k)|0;\
+ b=(a+b)|0;\
+ d=(b+c+i+j)|0;\
+ e=(a+j+c)|0;\
+ f=(a+i+k)|0;\
+ i8[i] = f;\
+ return (a+b+c+d+e+f)|0;\
+ }\
+ return g;';
+
+var buf=new ArrayBuffer(BUF_MIN);
+var g = asmLink(asmCompile('global','foreign','buffer',body), this, null, buf);
+assertEq(g(1,2,3), 46);
+assertEq(new Int8Array(buf)[1], 7);
+
+var body =
+' "use asm";\
+ var i8=new global.Int8Array(buffer);\
+ function g(i,j,k) {\
+ i=i|0;\
+ j=j|0;\
+ k=k|0;\
+ var a=0,b=0,c=0,d=0,e=0,f=0;\
+ a=(i+j)|0;\
+ b=(k+j)|0;\
+ c=(i+k)|0;\
+ b=(a+b)|0;\
+ d=(b+c+i+j)|0;\
+ e=(a+j+c)|0;\
+ f=(a+i+k)|0;\
+ i8[i] = e;\
+ return (a+b+c+d+e+f)|0;\
+ }\
+ return g;';
+
+var buf=new ArrayBuffer(BUF_MIN);
+var g = asmLink(asmCompile('global','foreign','buffer',body), this, null, buf);
+assertEq(g(1,2,3), 46);
+assertEq(new Int8Array(buf)[1], 9);
+
+var body =
+' "use asm";\
+ var i8=new global.Int8Array(buffer);\
+ function g(i,j,k) {\
+ i=i|0;\
+ j=j|0;\
+ k=k|0;\
+ var a=0,b=0,c=0,d=0,e=0,f=0,g=0;\
+ a=(i+j)|0;\
+ b=(k+j)|0;\
+ c=(i+k)|0;\
+ b=(a+b)|0;\
+ d=(b+c+i+j)|0;\
+ e=(a+j+c)|0;\
+ f=(a+i+k)|0;\
+ g=(f+j+b)|0;\
+ i8[i] = g;\
+ return (a+b+c+d+e+f+g)|0;\
+ }\
+ return g;';
+
+var buf=new ArrayBuffer(BUF_MIN);
+var g = asmLink(asmCompile('global','foreign','buffer',body), this, null, buf);
+assertEq(g(1,2,3), 63);
+assertEq(new Int8Array(buf)[1], 17);