diff options
-rw-r--r-- | src/intertyper.js | 1 | ||||
-rw-r--r-- | src/jsifier.js | 3 | ||||
-rw-r--r-- | tests/cases/atomicrmw.ll | 1 |
3 files changed, 5 insertions, 0 deletions
diff --git a/src/intertyper.js b/src/intertyper.js index c1a98354..cc0f045d 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -741,6 +741,7 @@ function intertyper(data, sidePass, baseLineNums) { processItem: function(item) { item.intertype = 'atomic'; if (item.tokens[0].text == 'atomicrmw') { + if (item.tokens[1].text == 'volatile') item.tokens.splice(1, 1); item.op = item.tokens[1].text; item.tokens.splice(1, 1); } else { diff --git a/src/jsifier.js b/src/jsifier.js index 7066f8c5..ca404258 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1204,6 +1204,9 @@ function JSify(data, functionsOnly, givenFunctions) { switch (item.op) { case 'add': return '(tempValue=' + makeGetValue(param1, 0, type) + ',' + makeSetValue(param1, 0, 'tempValue+' + param2, type, null, null, null, null, ',') + ',tempValue)'; case 'sub': return '(tempValue=' + makeGetValue(param1, 0, type) + ',' + makeSetValue(param1, 0, 'tempValue-' + param2, type, null, null, null, null, ',') + ',tempValue)'; + case 'or': return '(tempValue=' + makeGetValue(param1, 0, type) + ',' + makeSetValue(param1, 0, 'tempValue|' + param2, type, null, null, null, null, ',') + ',tempValue)'; + case 'and': return '(tempValue=' + makeGetValue(param1, 0, type) + ',' + makeSetValue(param1, 0, 'tempValue&' + param2, type, null, null, null, null, ',') + ',tempValue)'; + case 'xor': return '(tempValue=' + makeGetValue(param1, 0, type) + ',' + makeSetValue(param1, 0, 'tempValue^' + param2, type, null, null, null, null, ',') + ',tempValue)'; case 'xchg': return '(tempValue=' + makeGetValue(param1, 0, type) + ',' + makeSetValue(param1, 0, param2, type, null, null, null, null, ',') + ',tempValue)'; case 'cmpxchg': { var param3 = finalizeLLVMParameter(item.params[2]); diff --git a/tests/cases/atomicrmw.ll b/tests/cases/atomicrmw.ll index 2f5a4224..fe479dce 100644 --- a/tests/cases/atomicrmw.ll +++ b/tests/cases/atomicrmw.ll @@ -13,6 +13,7 @@ entry: %1 = atomicrmw add i32* %t, i32 3 seq_cst, ; [#uses=0 type=i32] [debug line = 21:12] %2 = load i32* %t %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %0, i32 %2) ; [#uses=0 type=i32] + %3 = atomicrmw volatile add i32* %t, i32 3 seq_cst, ; [#uses=0 type=i32] [debug line = 21:12] ret i32 1 } |