Log Message
[JSC] Add B3-to-Air lowering for BitXor https://bugs.webkit.org/show_bug.cgi?id=150872
Patch by Benjamin Poulain <bpoul...@apple.com> on 2015-11-03 Reviewed by Filip Pizlo. * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::xor32): Fix the indentation. * b3/B3Const32Value.cpp: (JSC::B3::Const32Value::bitXorConstant): * b3/B3Const32Value.h: * b3/B3Const64Value.cpp: (JSC::B3::Const64Value::bitXorConstant): * b3/B3Const64Value.h: * b3/B3LowerToAir.cpp: (JSC::B3::Air::LowerToAir::tryXor): * b3/B3LoweringMatcher.patterns: * b3/B3ReduceStrength.cpp: * b3/B3Value.cpp: (JSC::B3::Value::bitXorConstant): * b3/B3Value.h: * b3/air/AirOpcode.opcodes: * b3/testb3.cpp: (JSC::B3::testBitXorArgs): (JSC::B3::testBitXorSameArg): (JSC::B3::testBitXorImms): (JSC::B3::testBitXorArgImm): (JSC::B3::testBitXorImmArg): (JSC::B3::testBitXorBitXorArgImmImm): (JSC::B3::testBitXorImmBitXorArgImm): (JSC::B3::testBitXorArgs32): (JSC::B3::testBitXorSameArg32): (JSC::B3::testBitXorImms32): (JSC::B3::testBitXorArgImm32): (JSC::B3::testBitXorImmArg32): (JSC::B3::testBitXorBitXorArgImmImm32): (JSC::B3::testBitXorImmBitXorArgImm32): (JSC::B3::run):
Modified Paths
- trunk/Source/_javascript_Core/ChangeLog
- trunk/Source/_javascript_Core/assembler/MacroAssemblerX86Common.h
- trunk/Source/_javascript_Core/b3/B3Const32Value.cpp
- trunk/Source/_javascript_Core/b3/B3Const32Value.h
- trunk/Source/_javascript_Core/b3/B3Const64Value.cpp
- trunk/Source/_javascript_Core/b3/B3Const64Value.h
- trunk/Source/_javascript_Core/b3/B3LowerToAir.cpp
- trunk/Source/_javascript_Core/b3/B3LoweringMatcher.patterns
- trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp
- trunk/Source/_javascript_Core/b3/B3Value.cpp
- trunk/Source/_javascript_Core/b3/B3Value.h
- trunk/Source/_javascript_Core/b3/air/AirOpcode.opcodes
- trunk/Source/_javascript_Core/b3/testb3.cpp
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (192007 => 192008)
--- trunk/Source/_javascript_Core/ChangeLog 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-11-04 05:12:40 UTC (rev 192008)
@@ -1,3 +1,45 @@
+2015-11-03 Benjamin Poulain <bpoul...@apple.com>
+
+ [JSC] Add B3-to-Air lowering for BitXor
+ https://bugs.webkit.org/show_bug.cgi?id=150872
+
+ Reviewed by Filip Pizlo.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::xor32):
+ Fix the indentation.
+
+ * b3/B3Const32Value.cpp:
+ (JSC::B3::Const32Value::bitXorConstant):
+ * b3/B3Const32Value.h:
+ * b3/B3Const64Value.cpp:
+ (JSC::B3::Const64Value::bitXorConstant):
+ * b3/B3Const64Value.h:
+ * b3/B3LowerToAir.cpp:
+ (JSC::B3::Air::LowerToAir::tryXor):
+ * b3/B3LoweringMatcher.patterns:
+ * b3/B3ReduceStrength.cpp:
+ * b3/B3Value.cpp:
+ (JSC::B3::Value::bitXorConstant):
+ * b3/B3Value.h:
+ * b3/air/AirOpcode.opcodes:
+ * b3/testb3.cpp:
+ (JSC::B3::testBitXorArgs):
+ (JSC::B3::testBitXorSameArg):
+ (JSC::B3::testBitXorImms):
+ (JSC::B3::testBitXorArgImm):
+ (JSC::B3::testBitXorImmArg):
+ (JSC::B3::testBitXorBitXorArgImmImm):
+ (JSC::B3::testBitXorImmBitXorArgImm):
+ (JSC::B3::testBitXorArgs32):
+ (JSC::B3::testBitXorSameArg32):
+ (JSC::B3::testBitXorImms32):
+ (JSC::B3::testBitXorArgImm32):
+ (JSC::B3::testBitXorImmArg32):
+ (JSC::B3::testBitXorBitXorArgImmImm32):
+ (JSC::B3::testBitXorImmBitXorArgImm32):
+ (JSC::B3::run):
+
2015-11-03 Mark Lam <mark....@apple.com>
Add op_add tests to compare behavior of JIT generated code to the LLINT's.
Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerX86Common.h (192007 => 192008)
--- trunk/Source/_javascript_Core/assembler/MacroAssemblerX86Common.h 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerX86Common.h 2015-11-04 05:12:40 UTC (rev 192008)
@@ -418,9 +418,9 @@
void xor32(TrustedImm32 imm, RegisterID dest)
{
if (imm.m_value == -1)
- m_assembler.notl_r(dest);
+ m_assembler.notl_r(dest);
else
- m_assembler.xorl_ir(imm.m_value, dest);
+ m_assembler.xorl_ir(imm.m_value, dest);
}
void xor32(RegisterID src, Address dest)
Modified: trunk/Source/_javascript_Core/b3/B3Const32Value.cpp (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/B3Const32Value.cpp 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/B3Const32Value.cpp 2015-11-04 05:12:40 UTC (rev 192008)
@@ -75,6 +75,13 @@
return proc.add<Const32Value>(origin(), m_value | other->asInt32());
}
+Value* Const32Value::bitXorConstant(Procedure& proc, Value* other) const
+{
+ if (!other->hasInt32())
+ return nullptr;
+ return proc.add<Const32Value>(origin(), m_value ^ other->asInt32());
+}
+
Value* Const32Value::equalConstant(Procedure& proc, Value* other) const
{
if (!other->hasInt32())
Modified: trunk/Source/_javascript_Core/b3/B3Const32Value.h (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/B3Const32Value.h 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/B3Const32Value.h 2015-11-04 05:12:40 UTC (rev 192008)
@@ -46,6 +46,7 @@
Value* subConstant(Procedure&, Value* other) const override;
Value* bitAndConstant(Procedure&, Value* other) const override;
Value* bitOrConstant(Procedure&, Value* other) const override;
+ Value* bitXorConstant(Procedure&, Value* other) const override;
Value* equalConstant(Procedure&, Value* other) const override;
Value* notEqualConstant(Procedure&, Value* other) const override;
Modified: trunk/Source/_javascript_Core/b3/B3Const64Value.cpp (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/B3Const64Value.cpp 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/B3Const64Value.cpp 2015-11-04 05:12:40 UTC (rev 192008)
@@ -75,6 +75,13 @@
return proc.add<Const64Value>(origin(), m_value | other->asInt64());
}
+Value* Const64Value::bitXorConstant(Procedure& proc, Value* other) const
+{
+ if (!other->hasInt64())
+ return nullptr;
+ return proc.add<Const64Value>(origin(), m_value ^ other->asInt64());
+}
+
Value* Const64Value::equalConstant(Procedure& proc, Value* other) const
{
if (!other->hasInt64())
Modified: trunk/Source/_javascript_Core/b3/B3Const64Value.h (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/B3Const64Value.h 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/B3Const64Value.h 2015-11-04 05:12:40 UTC (rev 192008)
@@ -46,6 +46,7 @@
Value* subConstant(Procedure&, Value* other) const override;
Value* bitAndConstant(Procedure&, Value* other) const override;
Value* bitOrConstant(Procedure&, Value* other) const override;
+ Value* bitXorConstant(Procedure&, Value* other) const override;
Value* equalConstant(Procedure&, Value* other) const override;
Value* notEqualConstant(Procedure&, Value* other) const override;
Modified: trunk/Source/_javascript_Core/b3/B3LowerToAir.cpp (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/B3LowerToAir.cpp 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/B3LowerToAir.cpp 2015-11-04 05:12:40 UTC (rev 192008)
@@ -708,6 +708,21 @@
}
}
+ bool tryXor(Value* left, Value* right)
+ {
+ switch (left->type()) {
+ case Int32:
+ appendBinOp<Xor32, Commutative>(left, right);
+ return true;
+ case Int64:
+ appendBinOp<Xor64, Commutative>(left, right);
+ return true;
+ default:
+ // FIXME: Implement more types!
+ return false;
+ }
+ }
+
bool tryShl(Value* value, Value* amount)
{
Air::Opcode opcode = value->type() == Int32 ? Lshift32 : Lshift64;
Modified: trunk/Source/_javascript_Core/b3/B3LoweringMatcher.patterns (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/B3LoweringMatcher.patterns 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/B3LoweringMatcher.patterns 2015-11-04 05:12:40 UTC (rev 192008)
@@ -34,6 +34,7 @@
Sub = Sub(left, right)
And = BitAnd(left, right)
Or = BitOr(left, right)
+Xor = BitXor(left, right)
Shl = Shl(value, amount)
Modified: trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp 2015-11-04 05:12:40 UTC (rev 192008)
@@ -191,13 +191,13 @@
// Turn this: BitOr(constant1, constant2)
// Into this: constant1 | constant2
- if (Value* constantBitAnd = m_value->child(0)->bitOrConstant(m_proc, m_value->child(1))) {
- replaceWithNewValue(constantBitAnd);
+ if (Value* constantBitOr = m_value->child(0)->bitOrConstant(m_proc, m_value->child(1))) {
+ replaceWithNewValue(constantBitOr);
break;
}
- // Turn this: BitAnd(BitAnd(value, constant1), constant2)
- // Into this: BitAnd(value, constant1 & constant2).
+ // Turn this: BitOr(BitOr(value, constant1), constant2)
+ // Into this: BitOr(value, constant1 & constant2).
if (m_value->child(0)->opcode() == BitOr) {
Value* newConstant = m_value->child(1)->bitOrConstant(m_proc, m_value->child(0)->child(1));
if (newConstant) {
@@ -235,6 +235,54 @@
break;
+ case BitXor:
+ handleCommutativity();
+
+ // Turn this: BitXor(constant1, constant2)
+ // Into this: constant1 ^ constant2
+ if (Value* constantBitXor = m_value->child(0)->bitXorConstant(m_proc, m_value->child(1))) {
+ replaceWithNewValue(constantBitXor);
+ break;
+ }
+
+ // Turn this: BitXor(BitXor(value, constant1), constant2)
+ // Into this: BitXor(value, constant1 ^ constant2).
+ if (m_value->child(0)->opcode() == BitXor) {
+ Value* newConstant = m_value->child(1)->bitXorConstant(m_proc, m_value->child(0)->child(1));
+ if (newConstant) {
+ m_insertionSet.insertValue(m_index, newConstant);
+ m_value->child(0) = m_value->child(0)->child(0);
+ m_value->child(1) = newConstant;
+ m_changed = true;
+ }
+ }
+
+ // Turn this: BitXor(valueX, valueX)
+ // Into this: zero-constant.
+ if (m_value->child(0) == m_value->child(1)) {
+ Value* zeroConstant;
+ if (m_value->type() == Int32)
+ zeroConstant = m_proc.add<Const32Value>(m_value->origin(), 0);
+ else if (m_value->type() == Int64)
+ zeroConstant = m_proc.add<Const64Value>(m_value->origin(), 0);
+ else {
+ RELEASE_ASSERT(m_value->type() == Double);
+ zeroConstant = m_proc.add<ConstDoubleValue>(m_value->origin(), 0);
+ }
+ replaceWithNewValue(zeroConstant);
+ break;
+ }
+
+ // Turn this: BitXor(value, zero-constant)
+ // Into this: value.
+ if (m_value->child(1)->isInt(0)) {
+ m_value->replaceWithIdentity(m_value->child(0));
+ m_changed = true;
+ break;
+ }
+
+ break;
+
case Load8Z:
case Load8S:
case Load16Z:
Modified: trunk/Source/_javascript_Core/b3/B3Value.cpp (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/B3Value.cpp 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/B3Value.cpp 2015-11-04 05:12:40 UTC (rev 192008)
@@ -142,6 +142,11 @@
return nullptr;
}
+Value* Value::bitXorConstant(Procedure&, Value*) const
+{
+ return nullptr;
+}
+
Value* Value::equalConstant(Procedure&, Value*) const
{
return nullptr;
Modified: trunk/Source/_javascript_Core/b3/B3Value.h (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/B3Value.h 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/B3Value.h 2015-11-04 05:12:40 UTC (rev 192008)
@@ -114,6 +114,7 @@
virtual Value* subConstant(Procedure&, Value* other) const;
virtual Value* bitAndConstant(Procedure&, Value* other) const;
virtual Value* bitOrConstant(Procedure&, Value* other) const;
+ virtual Value* bitXorConstant(Procedure&, Value* other) const;
virtual Value* equalConstant(Procedure&, Value* other) const;
virtual Value* notEqualConstant(Procedure&, Value* other) const;
Modified: trunk/Source/_javascript_Core/b3/air/AirOpcode.opcodes (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/air/AirOpcode.opcodes 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/air/AirOpcode.opcodes 2015-11-04 05:12:40 UTC (rev 192008)
@@ -125,6 +125,18 @@
Tmp, Tmp
Imm, Tmp
+Xor32 U:G, UD:G
+ Tmp, Tmp
+ Imm, Tmp
+ Tmp, Addr
+ Addr, Tmp
+ Imm, Addr
+
+Xor64 U:G, UD:G
+ Tmp, Tmp
+ Tmp, Addr
+ Imm, Tmp
+
Lshift64 U:G, UD:G
Tmp*, Tmp
Imm, Tmp
Modified: trunk/Source/_javascript_Core/b3/testb3.cpp (192007 => 192008)
--- trunk/Source/_javascript_Core/b3/testb3.cpp 2015-11-04 02:47:50 UTC (rev 192007)
+++ trunk/Source/_javascript_Core/b3/testb3.cpp 2015-11-04 05:12:40 UTC (rev 192008)
@@ -738,6 +738,234 @@
CHECK(compileAndRun<int>(proc, b) == (a | (b | c)));
}
+void testBitXorArgs(int64_t a, int64_t b)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)));
+
+ CHECK(compileAndRun<int64_t>(proc, a, b) == (a ^ b));
+}
+
+void testBitXorSameArg(int64_t a)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ Value* argument = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ argument,
+ argument));
+
+ CHECK(!compileAndRun<int64_t>(proc, a));
+}
+
+void testBitXorImms(int64_t a, int64_t b)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<Const64Value>(proc, Origin(), a),
+ root->appendNew<Const64Value>(proc, Origin(), b)));
+
+ CHECK(compileAndRun<int64_t>(proc) == (a ^ b));
+}
+
+void testBitXorArgImm(int64_t a, int64_t b)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
+ root->appendNew<Const64Value>(proc, Origin(), b)));
+
+ CHECK(compileAndRun<int64_t>(proc, a) == (a ^ b));
+}
+
+void testBitXorImmArg(int64_t a, int64_t b)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<Const64Value>(proc, Origin(), a),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)));
+
+ CHECK(compileAndRun<int64_t>(proc, b) == (a ^ b));
+}
+
+void testBitXorBitXorArgImmImm(int64_t a, int64_t b, int64_t c)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ Value* innerBitXor = root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
+ root->appendNew<Const64Value>(proc, Origin(), b));
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ innerBitXor,
+ root->appendNew<Const64Value>(proc, Origin(), c)));
+
+ CHECK(compileAndRun<int64_t>(proc, a) == ((a ^ b) ^ c));
+}
+
+void testBitXorImmBitXorArgImm(int64_t a, int64_t b, int64_t c)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ Value* innerBitXor = root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
+ root->appendNew<Const64Value>(proc, Origin(), c));
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<Const64Value>(proc, Origin(), a),
+ innerBitXor));
+
+ CHECK(compileAndRun<int64_t>(proc, b) == (a ^ (b ^ c)));
+}
+
+void testBitXorArgs32(int a, int b)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<Value>(
+ proc, Trunc, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)),
+ root->appendNew<Value>(
+ proc, Trunc, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1))));
+
+ CHECK(compileAndRun<int>(proc, a, b) == (a ^ b));
+}
+
+void testBitXorSameArg32(int a)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ Value* argument = root->appendNew<Value>(
+ proc, Trunc, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ argument,
+ argument));
+
+ CHECK(!compileAndRun<int>(proc, a));
+}
+
+void testBitXorImms32(int a, int b)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<Const32Value>(proc, Origin(), a),
+ root->appendNew<Const32Value>(proc, Origin(), b)));
+
+ CHECK(compileAndRun<int>(proc) == (a ^ b));
+}
+
+void testBitXorArgImm32(int a, int b)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<Value>(
+ proc, Trunc, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)),
+ root->appendNew<Const32Value>(proc, Origin(), b)));
+
+ CHECK(compileAndRun<int>(proc, a) == (a ^ b));
+}
+
+void testBitXorImmArg32(int a, int b)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<Const32Value>(proc, Origin(), a),
+ root->appendNew<Value>(
+ proc, Trunc, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0))));
+
+ CHECK(compileAndRun<int>(proc, b) == (a ^ b));
+}
+
+void testBitXorBitXorArgImmImm32(int a, int b, int c)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ Value* innerBitXor = root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<Value>(
+ proc, Trunc, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)),
+ root->appendNew<Const32Value>(proc, Origin(), b));
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ innerBitXor,
+ root->appendNew<Const32Value>(proc, Origin(), c)));
+
+ CHECK(compileAndRun<int>(proc, a) == ((a ^ b) ^ c));
+}
+
+void testBitXorImmBitXorArgImm32(int a, int b, int c)
+{
+ Procedure proc;
+ BasicBlock* root = proc.addBlock();
+ Value* innerBitXor = root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<Value>(
+ proc, Trunc, Origin(),
+ root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)),
+ root->appendNew<Const32Value>(proc, Origin(), c));
+ root->appendNew<ControlValue>(
+ proc, Return, Origin(),
+ root->appendNew<Value>(
+ proc, BitXor, Origin(),
+ root->appendNew<Const32Value>(proc, Origin(), a),
+ innerBitXor));
+
+ CHECK(compileAndRun<int>(proc, b) == (a ^ (b ^ c)));
+}
+
void testStore(int value)
{
Procedure proc;
@@ -1937,6 +2165,59 @@
RUN(testBitOrImmBitOrArgImm32(6, 1, 6));
RUN(testBitOrImmBitOrArgImm32(24, 0xffff, 7));
+ RUN(testBitXorArgs(43, 43));
+ RUN(testBitXorArgs(43, 0));
+ RUN(testBitXorArgs(10, 3));
+ RUN(testBitXorArgs(42, 0xffffffffffffffff));
+ RUN(testBitXorSameArg(43));
+ RUN(testBitXorSameArg(0));
+ RUN(testBitXorSameArg(3));
+ RUN(testBitXorSameArg(0xffffffffffffffff));
+ RUN(testBitXorImms(43, 43));
+ RUN(testBitXorImms(43, 0));
+ RUN(testBitXorImms(10, 3));
+ RUN(testBitXorImms(42, 0xffffffffffffffff));
+ RUN(testBitXorArgImm(43, 43));
+ RUN(testBitXorArgImm(43, 0));
+ RUN(testBitXorArgImm(10, 3));
+ RUN(testBitXorArgImm(42, 0xffffffffffffffff));
+ RUN(testBitXorImmArg(43, 43));
+ RUN(testBitXorImmArg(43, 0));
+ RUN(testBitXorImmArg(10, 3));
+ RUN(testBitXorImmArg(42, 0xffffffffffffffff));
+ RUN(testBitXorBitXorArgImmImm(2, 7, 3));
+ RUN(testBitXorBitXorArgImmImm(1, 6, 6));
+ RUN(testBitXorBitXorArgImmImm(0xffff, 24, 7));
+ RUN(testBitXorImmBitXorArgImm(7, 2, 3));
+ RUN(testBitXorImmBitXorArgImm(6, 1, 6));
+ RUN(testBitXorImmBitXorArgImm(24, 0xffff, 7));
+ RUN(testBitXorArgs32(43, 43));
+ RUN(testBitXorArgs32(43, 0));
+ RUN(testBitXorArgs32(10, 3));
+ RUN(testBitXorArgs32(42, 0xffffffff));
+ RUN(testBitXorSameArg32(43));
+ RUN(testBitXorSameArg32(0));
+ RUN(testBitXorSameArg32(3));
+ RUN(testBitXorSameArg32(0xffffffff));
+ RUN(testBitXorImms32(43, 43));
+ RUN(testBitXorImms32(43, 0));
+ RUN(testBitXorImms32(10, 3));
+ RUN(testBitXorImms32(42, 0xffffffff));
+ RUN(testBitXorArgImm32(43, 43));
+ RUN(testBitXorArgImm32(43, 0));
+ RUN(testBitXorArgImm32(10, 3));
+ RUN(testBitXorArgImm32(42, 0xffffffff));
+ RUN(testBitXorImmArg32(43, 43));
+ RUN(testBitXorImmArg32(43, 0));
+ RUN(testBitXorImmArg32(10, 3));
+ RUN(testBitXorImmArg32(42, 0xffffffff));
+ RUN(testBitXorBitXorArgImmImm32(2, 7, 3));
+ RUN(testBitXorBitXorArgImmImm32(1, 6, 6));
+ RUN(testBitXorBitXorArgImmImm32(0xffff, 24, 7));
+ RUN(testBitXorImmBitXorArgImm32(7, 2, 3));
+ RUN(testBitXorImmBitXorArgImm32(6, 1, 6));
+ RUN(testBitXorImmBitXorArgImm32(24, 0xffff, 7));
+
RUN(testStore(44));
RUN(testStoreConstant(49));
RUN(testStoreConstantPtr(49));
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes