diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-14 10:23:33 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-14 10:23:33 -0800 |
commit | f39f71ff14c7bf0364d078e21315ff0bac5b2f1d (patch) | |
tree | 14c728e790ab5c7f1c2b7da35a3bf799823e9623 | |
parent | fe899d8249caf8614100de0e1eb2f5efae77dfa7 (diff) |
add testcase for i1 constants being properly unsigned
-rw-r--r-- | tests/cases/boolret_fastcomp.ll | 31 | ||||
-rw-r--r-- | tests/cases/boolret_fastcomp.txt | 2 | ||||
-rw-r--r-- | tests/test_core.py | 3 |
3 files changed, 36 insertions, 0 deletions
diff --git a/tests/cases/boolret_fastcomp.ll b/tests/cases/boolret_fastcomp.ll new file mode 100644 index 00000000..a20cd001 --- /dev/null +++ b/tests/cases/boolret_fastcomp.ll @@ -0,0 +1,31 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + +@.str = private unnamed_addr constant [15 x i8] c"helloworld%d.\0A\00", align 1 + +define i1 @boolretter() { + ret i1 -1 +} + +define i8 @smallretter() { + ret i8 -1 +} + +define i32 @main() { +entry: + %retval = alloca i32, align 4 ; [#uses=1 type=i32*] + store i32 0, i32* %retval + %bool = call i1 ()* @boolretter() + %combined = xor i1 %bool, 1 + %int = select i1 %combined, i32 20, i32 30 + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %int) + %small = call i8 ()* @smallretter() + %bcombined = xor i8 %small, 1 + %bcheck = icmp eq i8 %bcombined, 255 + %bint = select i1 %bcheck, i32 20, i32 30 + %bcall = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i32 %bint) + ret i32 1 +} + +declare i32 @printf(i8*, ...) diff --git a/tests/cases/boolret_fastcomp.txt b/tests/cases/boolret_fastcomp.txt new file mode 100644 index 00000000..e1ad61ab --- /dev/null +++ b/tests/cases/boolret_fastcomp.txt @@ -0,0 +1,2 @@ +helloworld30. +helloworld30. diff --git a/tests/test_core.py b/tests/test_core.py index 2b5ad48e..6a9ef979 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5140,6 +5140,9 @@ def process(filename): if '_le32' in shortname and not self.is_le32(): print self.skip('case "%s" not relevant for non-le32 target' % shortname) continue + if '_fastcomp' in shortname and not os.environ.get('EMCC_FAST_COMPILER') == '1': + print self.skip('case "%s" not relevant for non-fastcomp' % shortname) + continue self.emcc_args = emcc_args if os.path.exists(shortname + '.emcc'): if not self.emcc_args: continue |