aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-10-17 17:53:52 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-18 13:00:49 -0700
commite623c44997c1dffd0ff3b8215b0ecdb076c68715 (patch)
treee209677fddda4244bd5f5982bc7cfe22e5d10b3a
parentacb4008cc0fc67d26e9fea45284ac6331f17f3c1 (diff)
insertelement
-rw-r--r--src/jsifier.js5
-rw-r--r--src/parseTools.js2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index e25296e5..c8e2e7cc 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1361,7 +1361,10 @@ function JSify(data, functionsOnly, givenFunctions) {
return ret + item.ident + '.f' + item.indexes[0][0].text + '=' + finalizeLLVMParameter(item.value) + ', ' + item.ident + ')';
}
function insertelementHandler(item) {
- return 'TODO';
+ var base = getVectorBaseType(item.type);
+ var ident = item.ident;
+ if (ident == 0) ident = base + '32x4.zero()';
+ return ident + '.with' + SIMDLane[finalizeLLVMParameter(item.index)] + '(' + finalizeLLVMParameter(item.value) + ')';
}
function shufflevectorHandler(item) {
return 'TODO';
diff --git a/src/parseTools.js b/src/parseTools.js
index 9b497aff..e921e5ca 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -2625,3 +2625,5 @@ function addVariable(ident, type, funcData) {
}
}
+var SIMDLane = ['X', 'Y', 'Z', 'W'];
+