[JSC] Remove some invalid immediate instruction forms from ARM64 Air
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jan 2016 20:05:52 +0000 (20:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jan 2016 20:05:52 +0000 (20:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153024

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-01-12
Reviewed by Michael Saboff.

* b3/B3BasicBlock.h:
Export the symbols for testb3.

* b3/air/AirOpcode.opcodes:
We had 2 invalid opcodes:
-Compare with immediate just does not exist.
-Test64 with immediate exists but Air does not recognize
 the valid form of bit-immediates.

* b3/testb3.cpp:
(JSC::B3::genericTestCompare):
(JSC::B3::testCompareImpl):
Extend the tests to cover what was invalid.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194915 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/b3/B3BasicBlock.h
Source/JavaScriptCore/b3/air/AirOpcode.opcodes
Source/JavaScriptCore/b3/testb3.cpp

index d18ddd0..a996447 100644 (file)
@@ -1,5 +1,26 @@
 2016-01-12  Benjamin Poulain  <bpoulain@apple.com>
 
+        [JSC] Remove some invalid immediate instruction forms from ARM64 Air
+        https://bugs.webkit.org/show_bug.cgi?id=153024
+
+        Reviewed by Michael Saboff.
+
+        * b3/B3BasicBlock.h:
+        Export the symbols for testb3.
+
+        * b3/air/AirOpcode.opcodes:
+        We had 2 invalid opcodes:
+        -Compare with immediate just does not exist.
+        -Test64 with immediate exists but Air does not recognize
+         the valid form of bit-immediates.
+
+        * b3/testb3.cpp:
+        (JSC::B3::genericTestCompare):
+        (JSC::B3::testCompareImpl):
+        Extend the tests to cover what was invalid.
+
+2016-01-12  Benjamin Poulain  <bpoulain@apple.com>
+
         [JSC] JSC does not build with FTL_USES_B3 on ARM64
         https://bugs.webkit.org/show_bug.cgi?id=153011
 
index f6888ca..5d95907 100644 (file)
@@ -76,7 +76,7 @@ public:
     template<typename ValueType, typename... Arguments>
     ValueType* appendNew(Procedure&, Arguments...);
 
-    Value* appendIntConstant(Procedure&, Origin, Type, int64_t value);
+    JS_EXPORT_PRIVATE Value* appendIntConstant(Procedure&, Origin, Type, int64_t value);
     Value* appendIntConstant(Procedure&, Value* likeValue, int64_t value);
 
     void removeLast(Procedure&);
index 4a21c7d..5e7ca07 100644 (file)
@@ -517,15 +517,15 @@ Compare32 U:G:32, U:G:32, U:G:32, ZD:G:32
     x86: RelCond, Tmp, Imm, Tmp
 
 64: Compare64 U:G:32, U:G:64, U:G:64, ZD:G:32
-    RelCond, Tmp, Imm, Tmp
     RelCond, Tmp, Tmp, Tmp
+    x86: RelCond, Tmp, Imm, Tmp
 
 Test32 U:G:32, U:G:32, U:G:32, ZD:G:32
     x86: ResCond, Addr, Imm, Tmp
     ResCond, Tmp, Tmp, Tmp
 
 64: Test64 U:G:32, U:G:64, U:G:64, ZD:G:32
-    ResCond, Tmp, Imm, Tmp
+    x86: ResCond, Tmp, Imm, Tmp
     ResCond, Tmp, Tmp, Tmp
 
 CompareDouble U:G:32, U:F:64, U:F:64, ZD:G:32
index 9a085c0..26f8a76 100644 (file)
@@ -7436,10 +7436,10 @@ void testCheckMulFoldFail(int a, int b)
     CHECK(invoke<int>(*code) == 42);
 }
 
-template<typename LeftFunctor, typename RightFunctor>
+template<typename LeftFunctor, typename RightFunctor, typename InputType>
 void genericTestCompare(
     B3::Opcode opcode, const LeftFunctor& leftFunctor, const RightFunctor& rightFunctor,
-    int left, int right, int result)
+    InputType left, InputType right, int result)
 {
     // Using a compare.
     {
@@ -7448,13 +7448,14 @@ void genericTestCompare(
 
         Value* leftValue = leftFunctor(root, proc);
         Value* rightValue = rightFunctor(root, proc);
+        Value* comparisonResult = root->appendNew<Value>(proc, opcode, Origin(), leftValue, rightValue);
         
         root->appendNew<ControlValue>(
             proc, Return, Origin(),
             root->appendNew<Value>(
                 proc, NotEqual, Origin(),
-                root->appendNew<Value>(proc, opcode, Origin(), leftValue, rightValue),
-                root->appendNew<Const32Value>(proc, Origin(), 0)));
+                comparisonResult,
+                root->appendIntConstant(proc, Origin(), comparisonResult->type(), 0)));
 
         CHECK(compileAndRun<int>(proc, left, right) == result);
     }
@@ -7608,7 +7609,7 @@ void testCompareLoad(B3::Opcode opcode, B3::Opcode loadOpcode, int left, int rig
         left, left, modelCompare(opcode, modelLoad<T>(left), modelLoad<T>(left)));
 }
 
-void testCompareImpl(B3::Opcode opcode, int left, int right)
+void testCompareImpl(B3::Opcode opcode, int64_t left, int64_t right)
 {
     int result = modelCompare(opcode, left, right);
     
@@ -7616,6 +7617,15 @@ void testCompareImpl(B3::Opcode opcode, int left, int right)
     genericTestCompare(
         opcode,
         [&] (BasicBlock* block, Procedure& proc) {
+            return block->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
+        },
+        [&] (BasicBlock* block, Procedure& proc) {
+            return block->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1);
+        },
+        left, right, result);
+    genericTestCompare(
+        opcode,
+        [&] (BasicBlock* block, Procedure& proc) {
             return block->appendNew<Value>(
                 proc, Trunc, Origin(),
                 block->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
@@ -7631,6 +7641,15 @@ void testCompareImpl(B3::Opcode opcode, int left, int right)
     genericTestCompare(
         opcode,
         [&] (BasicBlock* block, Procedure& proc) {
+            return block->appendNew<Const64Value>(proc, Origin(), left);
+        },
+        [&] (BasicBlock* block, Procedure& proc) {
+            return block->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1);
+        },
+        left, right, result);
+    genericTestCompare(
+        opcode,
+        [&] (BasicBlock* block, Procedure& proc) {
             return block->appendNew<Const32Value>(proc, Origin(), left);
         },
         [&] (BasicBlock* block, Procedure& proc) {
@@ -7644,6 +7663,15 @@ void testCompareImpl(B3::Opcode opcode, int left, int right)
     genericTestCompare(
         opcode,
         [&] (BasicBlock* block, Procedure& proc) {
+            return block->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
+        },
+        [&] (BasicBlock* block, Procedure& proc) {
+            return block->appendNew<Const64Value>(proc, Origin(), right);
+        },
+        left, right, result);
+    genericTestCompare(
+        opcode,
+        [&] (BasicBlock* block, Procedure& proc) {
             return block->appendNew<Value>(
                 proc, Trunc, Origin(),
                 block->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
@@ -7657,6 +7685,15 @@ void testCompareImpl(B3::Opcode opcode, int left, int right)
     genericTestCompare(
         opcode,
         [&] (BasicBlock* block, Procedure& proc) {
+            return block->appendNew<Const64Value>(proc, Origin(), left);
+        },
+        [&] (BasicBlock* block, Procedure& proc) {
+            return block->appendNew<Const64Value>(proc, Origin(), right);
+        },
+        left, right, result);
+    genericTestCompare(
+        opcode,
+        [&] (BasicBlock* block, Procedure& proc) {
             return block->appendNew<Const32Value>(proc, Origin(), left);
         },
         [&] (BasicBlock* block, Procedure& proc) {