Title: [194312] trunk/Source/_javascript_Core
Revision
194312
Author
[email protected]
Date
2015-12-19 01:01:00 -0800 (Sat, 19 Dec 2015)

Log Message

[JSC] B3: Add indexed addressing when lowering BitwiseCast
https://bugs.webkit.org/show_bug.cgi?id=152432

Patch by Benjamin Poulain <[email protected]> on 2015-12-19
Reviewed by Geoffrey Garen.

The MacroAssembler supports it, we should use it.

* b3/air/AirOpcode.opcodes:
* b3/testb3.cpp:
(JSC::B3::testBitwiseCastOnDoubleInMemoryIndexed):
(JSC::B3::testBitwiseCastOnInt64InMemoryIndexed):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (194311 => 194312)


--- trunk/Source/_javascript_Core/ChangeLog	2015-12-19 06:44:50 UTC (rev 194311)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-12-19 09:01:00 UTC (rev 194312)
@@ -1,3 +1,17 @@
+2015-12-19  Benjamin Poulain  <[email protected]>
+
+        [JSC] B3: Add indexed addressing when lowering BitwiseCast
+        https://bugs.webkit.org/show_bug.cgi?id=152432
+
+        Reviewed by Geoffrey Garen.
+
+        The MacroAssembler supports it, we should use it.
+
+        * b3/air/AirOpcode.opcodes:
+        * b3/testb3.cpp:
+        (JSC::B3::testBitwiseCastOnDoubleInMemoryIndexed):
+        (JSC::B3::testBitwiseCastOnInt64InMemoryIndexed):
+
 2015-12-18  Andreas Kling  <[email protected]>
 
         Make JSString::SafeView less of a footgun.

Modified: trunk/Source/_javascript_Core/b3/air/AirOpcode.opcodes (194311 => 194312)


--- trunk/Source/_javascript_Core/b3/air/AirOpcode.opcodes	2015-12-19 06:44:50 UTC (rev 194311)
+++ trunk/Source/_javascript_Core/b3/air/AirOpcode.opcodes	2015-12-19 09:01:00 UTC (rev 194312)
@@ -380,18 +380,22 @@
 64: Move64ToDouble U:G, D:F
     Tmp, Tmp
     Addr, Tmp as loadDouble
+    Index, Tmp as loadDouble
 
 MoveInt32ToPacked U:G, D:F
     Tmp, Tmp
     Addr, Tmp as loadFloat
+    Index, Tmp as loadFloat
 
 64: MoveDoubleTo64 U:F, D:G
     Tmp, Tmp
     Addr, Tmp as load64
+    Index, Tmp as load64
 
 MovePackedToInt32 U:F, D:G
     Tmp, Tmp
     Addr, Tmp as load32
+    Index, Tmp as load32
 
 Load8 U:G, D:G
     Addr, Tmp

Modified: trunk/Source/_javascript_Core/b3/testb3.cpp (194311 => 194312)


--- trunk/Source/_javascript_Core/b3/testb3.cpp	2015-12-19 06:44:50 UTC (rev 194311)
+++ trunk/Source/_javascript_Core/b3/testb3.cpp	2015-12-19 09:01:00 UTC (rev 194312)
@@ -3570,6 +3570,23 @@
     CHECK(isIdentical(compileAndRun<int64_t>(proc, &value), bitwise_cast<int64_t>(value)));
 }
 
+void testBitwiseCastOnDoubleInMemoryIndexed(double value)
+{
+    Procedure proc;
+    BasicBlock* root = proc.addBlock();
+    Value* base = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
+    Value* offset = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1);
+    Value* scaledOffset = root->appendNew<Value>(proc, Shl, Origin(),
+        offset,
+        root->appendNew<Const32Value>(proc, Origin(), 3));
+    Value* address = root->appendNew<Value>(proc, Add, Origin(), base, scaledOffset);
+    MemoryValue* loadDouble = root->appendNew<MemoryValue>(proc, Load, Double, Origin(), address);
+    Value* cast = root->appendNew<Value>(proc, BitwiseCast, Origin(), loadDouble);
+    root->appendNew<ControlValue>(proc, Return, Origin(), cast);
+
+    CHECK(isIdentical(compileAndRun<int64_t>(proc, &value, 0), bitwise_cast<int64_t>(value)));
+}
+
 void testInt64BArgToDoubleBitwiseCast(int64_t value)
 {
     Procedure proc;
@@ -3622,6 +3639,23 @@
     CHECK(isIdentical(compileAndRun<double>(proc, &value), bitwise_cast<double>(value)));
 }
 
+void testBitwiseCastOnInt64InMemoryIndexed(int64_t value)
+{
+    Procedure proc;
+    BasicBlock* root = proc.addBlock();
+    Value* base = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
+    Value* offset = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1);
+    Value* scaledOffset = root->appendNew<Value>(proc, Shl, Origin(),
+        offset,
+        root->appendNew<Const32Value>(proc, Origin(), 3));
+    Value* address = root->appendNew<Value>(proc, Add, Origin(), base, scaledOffset);
+    MemoryValue* loadDouble = root->appendNew<MemoryValue>(proc, Load, Int64, Origin(), address);
+    Value* cast = root->appendNew<Value>(proc, BitwiseCast, Origin(), loadDouble);
+    root->appendNew<ControlValue>(proc, Return, Origin(), cast);
+
+    CHECK(isIdentical(compileAndRun<double>(proc, &value, 0), bitwise_cast<double>(value)));
+}
+
 void testFloatImmToInt32BitwiseCast(float value)
 {
     Procedure proc;
@@ -9019,10 +9053,12 @@
     RUN_UNARY(testDoubleImmToInt64BitwiseCast, floatingPointOperands<double>());
     RUN_UNARY(testTwoBitwiseCastOnDouble, floatingPointOperands<double>());
     RUN_UNARY(testBitwiseCastOnDoubleInMemory, floatingPointOperands<double>());
+    RUN_UNARY(testBitwiseCastOnDoubleInMemoryIndexed, floatingPointOperands<double>());
     RUN_UNARY(testInt64BArgToDoubleBitwiseCast, int64Operands());
     RUN_UNARY(testInt64BImmToDoubleBitwiseCast, int64Operands());
     RUN_UNARY(testTwoBitwiseCastOnInt64, int64Operands());
     RUN_UNARY(testBitwiseCastOnInt64InMemory, int64Operands());
+    RUN_UNARY(testBitwiseCastOnInt64InMemoryIndexed, int64Operands());
     RUN_UNARY(testFloatImmToInt32BitwiseCast, floatingPointOperands<float>());
     RUN_UNARY(testBitwiseCastOnFloatInMemory, floatingPointOperands<float>());
     RUN_UNARY(testInt32BArgToFloatBitwiseCast, int32Operands());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to