aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-02-08 12:14:15 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-02-08 12:14:15 -0800
commit6f0ff33511e674c10dabd45c48e1e85d90981dd8 (patch)
tree4b3a1925483e013b50befbcd42ce40356592ff31
parentd3f0585b4735fa4fe39cf8837920ab84f563ca8b (diff)
improve legalize testcase with a phi
-rw-r--r--src/parseTools.js8
-rw-r--r--tests/cases/legalizer_ta2.ll15
-rw-r--r--tests/cases/legalizer_ta2.txt1
3 files changed, 19 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 29b8bdbf..3cc17cc4 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -966,13 +966,11 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe,
makeSetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('i32')), 'tempDoubleI32[1]', 'i32', noNeedFirst, ignore, align, noSafe, ',') + ')';
}
- if (!align && isIntImplemented(type) && !isPowerOfTwo(getBits(type))) {
- align = 1; // we need to split this up, as if alignment were 1, this is an unnatural type like i24
- }
- if (USE_TYPED_ARRAYS == 2 && align) {
+ var needSplitting = isIntImplemented(type) && !isPowerOfTwo(getBits(type)); // an unnatural type like i24
+ if (USE_TYPED_ARRAYS == 2 && (align || needSplitting)) {
// Alignment is important here, or we need to split this up for other reasons.
var bytes = Runtime.getNativeTypeSize(type);
- if (bytes > align) {
+ if (bytes > align || needSplitting) {
var ret = '';
if (isIntImplemented(type)) {
if (bytes == 4 && align == 2) {
diff --git a/tests/cases/legalizer_ta2.ll b/tests/cases/legalizer_ta2.ll
index a877c683..67cd9feb 100644
--- a/tests/cases/legalizer_ta2.ll
+++ b/tests/cases/legalizer_ta2.ll
@@ -101,6 +101,21 @@ entry:
store i80 %loaded.short, i80* bitcast ([300 x i8]* @globaliz to i80*), align 4
call i32 (i8*)* @puts(i8* bitcast ([300 x i8]* @globaliz to i8*))
+; phi
+ %if = trunc i104 %ander to i1
+ %first = trunc i104 %xored to i88
+ br i1 %if, label %a17, label %a26
+
+a17:
+ %second = trunc i104 %loaded to i88
+ br label %a26
+
+a26:
+ %a27 = phi i88 [ %first, %entry ], [ %second, %a17 ]
+ store i104 0, i104* %bundled, align 4 ; wipe it out
+ store i88 %a27, i88* bitcast ([300 x i8]* @globaliz to i88*), align 4
+ call i32 (i8*)* @puts(i8* bitcast ([300 x i8]* @globaliz to i8*))
+
ret i32 1
}
diff --git a/tests/cases/legalizer_ta2.txt b/tests/cases/legalizer_ta2.txt
index e05a4816..e25076e6 100644
--- a/tests/cases/legalizer_ta2.txt
+++ b/tests/cases/legalizer_ta2.txt
@@ -15,3 +15,4 @@ hellon worod
hello, war`d
hello, wor-d
hello, wor
+hello, worl