aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-22 17:21:19 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-23 16:03:06 -0700
commit2a0f90ac5964f73e5e5b8bee35a8962ba9cca4a2 (patch)
treeea3d0d2c57f10b1e2555ff7279d6fa2f048c8c24 /tests
parent46aac5343e53225f1e9bc74c584ecb9b6afd74a1 (diff)
asm coerce in atomicrmw; fixes #1637
Diffstat (limited to 'tests')
-rw-r--r--tests/cases/atomicrmw_unaligned.emcc1
-rw-r--r--tests/cases/atomicrmw_unaligned.ll21
-rw-r--r--tests/cases/atomicrmw_unaligned.txt1
-rw-r--r--tests/test_core.py7
4 files changed, 30 insertions, 0 deletions
diff --git a/tests/cases/atomicrmw_unaligned.emcc b/tests/cases/atomicrmw_unaligned.emcc
new file mode 100644
index 00000000..9faeda24
--- /dev/null
+++ b/tests/cases/atomicrmw_unaligned.emcc
@@ -0,0 +1 @@
+["-s", "UNALIGNED_MEMORY=1"]
diff --git a/tests/cases/atomicrmw_unaligned.ll b/tests/cases/atomicrmw_unaligned.ll
new file mode 100644
index 00000000..fe479dce
--- /dev/null
+++ b/tests/cases/atomicrmw_unaligned.ll
@@ -0,0 +1,21 @@
+; ModuleID = 'tests/hello_world.bc'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
+target triple = "i386-pc-linux-gnu"
+
+@.str = private unnamed_addr constant [15 x i8] c"hello, %d,%d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*]
+
+; [#uses=0]
+define i32 @main() {
+entry:
+ %t = alloca i32, align 4 ; [#uses=2 type=i32**]
+ store i32 50, i32* %t, align 4
+ %0 = load i32* %t
+ %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
+}
+
+; [#uses=1]
+declare i32 @printf(i8*, ...)
diff --git a/tests/cases/atomicrmw_unaligned.txt b/tests/cases/atomicrmw_unaligned.txt
new file mode 100644
index 00000000..45d16fb1
--- /dev/null
+++ b/tests/cases/atomicrmw_unaligned.txt
@@ -0,0 +1 @@
+hello, 50,53!
diff --git a/tests/test_core.py b/tests/test_core.py
index 4c17a942..0b6528e7 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -8937,6 +8937,8 @@ def process(filename):
def test_cases(self):
if Building.LLVM_OPTS: return self.skip("Our code is not exactly 'normal' llvm assembly")
+ emcc_args = self.emcc_args
+
try:
os.environ['EMCC_LEAVE_INPUTS_RAW'] = '1'
Settings.CHECK_OVERFLOWS = 0
@@ -8950,6 +8952,10 @@ def process(filename):
if '_noasm' in shortname and Settings.ASM_JS:
print self.skip('case "%s" not relevant for asm.js' % shortname)
continue
+ if os.path.exists(shortname + '.emcc'):
+ self.emcc_args = emcc_args
+ if not self.emcc_args: continue
+ self.emcc_args += json.loads(open(shortname + '.emcc').read())
print >> sys.stderr, "Testing case '%s'..." % shortname
output_file = path_from_root('tests', 'cases', shortname + '.txt')
if Settings.QUANTUM_SIZE == 1:
@@ -8970,6 +8976,7 @@ def process(filename):
finally:
del os.environ['EMCC_LEAVE_INPUTS_RAW']
+ self.emcc_args = emcc_args
def test_fuzz(self):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('needs ta2')