Diff
Modified: trunk/JSTests/ChangeLog (208854 => 208855)
--- trunk/JSTests/ChangeLog 2016-11-17 19:07:31 UTC (rev 208854)
+++ trunk/JSTests/ChangeLog 2016-11-17 19:21:42 UTC (rev 208855)
@@ -1,5 +1,14 @@
2016-11-17 Keith Miller <keith_mil...@apple.com>
+ Add rotate to Wasm
+ https://bugs.webkit.org/show_bug.cgi?id=164871
+
+ Reviewed by Filip Pizlo.
+
+ * wasm/wasm.json:
+
+2016-11-17 Keith Miller <keith_mil...@apple.com>
+
Add sqrt to Wasm
https://bugs.webkit.org/show_bug.cgi?id=164877
Modified: trunk/JSTests/wasm/wasm.json (208854 => 208855)
--- trunk/JSTests/wasm/wasm.json 2016-11-17 19:07:31 UTC (rev 208854)
+++ trunk/JSTests/wasm/wasm.json 2016-11-17 19:21:42 UTC (rev 208855)
@@ -105,8 +105,8 @@
"i32.shl": { "category": "arithmetic", "value": 74, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "Shl" },
"i32.shr_u": { "category": "arithmetic", "value": 75, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "SShr" },
"i32.shr_s": { "category": "arithmetic", "value": 76, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "ZShr" },
- "i32.rotr": { "category": "arithmetic", "value": 182, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [] },
- "i32.rotl": { "category": "arithmetic", "value": 183, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [] },
+ "i32.rotr": { "category": "arithmetic", "value": 182, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "RotR" },
+ "i32.rotl": { "category": "arithmetic", "value": 183, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "RotL" },
"i32.eq": { "category": "comparison", "value": 77, "return": ["bool"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "Equal" },
"i32.ne": { "category": "comparison", "value": 78, "return": ["bool"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "NotEqual" },
"i32.lt_s": { "category": "comparison", "value": 79, "return": ["bool"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "LessThan" },
@@ -134,8 +134,8 @@
"i64.shl": { "category": "arithmetic", "value": 101, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "Shl" },
"i64.shr_u": { "category": "arithmetic", "value": 102, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "SShr" },
"i64.shr_s": { "category": "arithmetic", "value": 103, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "ZShr" },
- "i64.rotr": { "category": "arithmetic", "value": 184, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [] },
- "i64.rotl": { "category": "arithmetic", "value": 185, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [] },
+ "i64.rotr": { "category": "arithmetic", "value": 184, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "RotR" },
+ "i64.rotl": { "category": "arithmetic", "value": 185, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "RotL" },
"i64.eq": { "category": "comparison", "value": 104, "return": ["bool"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "Equal" },
"i64.ne": { "category": "comparison", "value": 105, "return": ["bool"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "NotEqual" },
"i64.lt_s": { "category": "comparison", "value": 106, "return": ["bool"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "LessThan" },
Modified: trunk/Source/_javascript_Core/ChangeLog (208854 => 208855)
--- trunk/Source/_javascript_Core/ChangeLog 2016-11-17 19:07:31 UTC (rev 208854)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-11-17 19:21:42 UTC (rev 208855)
@@ -1,5 +1,26 @@
2016-11-17 Keith Miller <keith_mil...@apple.com>
+ Add rotate to Wasm
+ https://bugs.webkit.org/show_bug.cgi?id=164871
+
+ Reviewed by Filip Pizlo.
+
+ Add rotate left and rotate right to Wasm. These directly map to B3 opcodes.
+ This also moves arm specific transformations of rotate left to lower macros
+ after optimization. It's a bad idea to have platform specific canonicalizations
+ in reduce strength since other optimizations may not be aware of it.
+
+ Add a bug to do pure CSE after lower macros after optimization since we want to
+ clean up RotL(value, Neg(Neg(shift))).
+
+ * b3/B3Generate.cpp:
+ (JSC::B3::generateToAir):
+ * b3/B3LowerMacrosAfterOptimizations.cpp:
+ * b3/B3ReduceStrength.cpp:
+ * wasm/wasm.json:
+
+2016-11-17 Keith Miller <keith_mil...@apple.com>
+
Add sqrt to Wasm
https://bugs.webkit.org/show_bug.cgi?id=164877
Modified: trunk/Source/_javascript_Core/b3/B3Generate.cpp (208854 => 208855)
--- trunk/Source/_javascript_Core/b3/B3Generate.cpp 2016-11-17 19:07:31 UTC (rev 208854)
+++ trunk/Source/_javascript_Core/b3/B3Generate.cpp 2016-11-17 19:21:42 UTC (rev 208855)
@@ -105,6 +105,9 @@
legalizeMemoryOffsets(procedure);
moveConstants(procedure);
+ // FIXME: We should run pureCSE here to clean up some platform specific changes from the previous phases.
+ // https://bugs.webkit.org/show_bug.cgi?id=164873
+
if (shouldValidateIR())
validate(procedure);
Modified: trunk/Source/_javascript_Core/b3/B3LowerMacrosAfterOptimizations.cpp (208854 => 208855)
--- trunk/Source/_javascript_Core/b3/B3LowerMacrosAfterOptimizations.cpp 2016-11-17 19:07:31 UTC (rev 208854)
+++ trunk/Source/_javascript_Core/b3/B3LowerMacrosAfterOptimizations.cpp 2016-11-17 19:21:42 UTC (rev 208855)
@@ -152,6 +152,19 @@
m_value->replaceWithIdentity(result);
break;
}
+
+ case RotL: {
+ // ARM64 doesn't have a rotate left.
+ if (isARM64()) {
+ if (isARM64()) {
+ Value* newShift = m_insertionSet.insert<Value>(m_index, Neg, m_value->origin(), m_value->child(1));
+ Value* rotate = m_insertionSet.insert<Value>(m_index, RotR, m_value->origin(), m_value->child(0), newShift);
+ m_value->replaceWithIdentity(rotate);
+ break;
+ }
+ }
+ break;
+ }
default:
break;
}
Modified: trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp (208854 => 208855)
--- trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp 2016-11-17 19:07:31 UTC (rev 208854)
+++ trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp 2016-11-17 19:21:42 UTC (rev 208855)
@@ -1162,16 +1162,6 @@
break;
}
- // ARM64 only has rotate right.
- // Turn this: RotL(value, shift)
- // Into this: RotR(value, Neg(shift))
- if (isARM64()) {
- Value* newShift = m_insertionSet.insert<Value>(m_index, Neg, m_value->origin(), m_value->child(1));
- Value* rotate = m_insertionSet.insert<Value>(m_index, RotR, m_value->origin(), m_value->child(0), newShift);
- replaceWithIdentity(rotate);
- break;
- }
-
handleShiftAmount();
break;
Modified: trunk/Source/_javascript_Core/wasm/wasm.json (208854 => 208855)
--- trunk/Source/_javascript_Core/wasm/wasm.json 2016-11-17 19:07:31 UTC (rev 208854)
+++ trunk/Source/_javascript_Core/wasm/wasm.json 2016-11-17 19:21:42 UTC (rev 208855)
@@ -105,8 +105,8 @@
"i32.shl": { "category": "arithmetic", "value": 74, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "Shl" },
"i32.shr_u": { "category": "arithmetic", "value": 75, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "SShr" },
"i32.shr_s": { "category": "arithmetic", "value": 76, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "ZShr" },
- "i32.rotr": { "category": "arithmetic", "value": 182, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [] },
- "i32.rotl": { "category": "arithmetic", "value": 183, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [] },
+ "i32.rotr": { "category": "arithmetic", "value": 182, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "RotR" },
+ "i32.rotl": { "category": "arithmetic", "value": 183, "return": ["i32"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "RotL" },
"i32.eq": { "category": "comparison", "value": 77, "return": ["bool"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "Equal" },
"i32.ne": { "category": "comparison", "value": 78, "return": ["bool"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "NotEqual" },
"i32.lt_s": { "category": "comparison", "value": 79, "return": ["bool"], "parameter": ["i32", "i32"], "immediate": [], "b3op": "LessThan" },
@@ -134,8 +134,8 @@
"i64.shl": { "category": "arithmetic", "value": 101, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "Shl" },
"i64.shr_u": { "category": "arithmetic", "value": 102, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "SShr" },
"i64.shr_s": { "category": "arithmetic", "value": 103, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "ZShr" },
- "i64.rotr": { "category": "arithmetic", "value": 184, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [] },
- "i64.rotl": { "category": "arithmetic", "value": 185, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [] },
+ "i64.rotr": { "category": "arithmetic", "value": 184, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "RotR" },
+ "i64.rotl": { "category": "arithmetic", "value": 185, "return": ["i64"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "RotL" },
"i64.eq": { "category": "comparison", "value": 104, "return": ["bool"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "Equal" },
"i64.ne": { "category": "comparison", "value": 105, "return": ["bool"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "NotEqual" },
"i64.lt_s": { "category": "comparison", "value": 106, "return": ["bool"], "parameter": ["i64", "i64"], "immediate": [], "b3op": "LessThan" },
Modified: trunk/Websites/webkit.org/ChangeLog (208854 => 208855)
--- trunk/Websites/webkit.org/ChangeLog 2016-11-17 19:07:31 UTC (rev 208854)
+++ trunk/Websites/webkit.org/ChangeLog 2016-11-17 19:21:42 UTC (rev 208855)
@@ -1,3 +1,14 @@
+2016-11-17 Keith Miller <keith_mil...@apple.com>
+
+ Add rotate to Wasm
+ https://bugs.webkit.org/show_bug.cgi?id=164871
+
+ Reviewed by Filip Pizlo.
+
+ Update docs for new rotate instructions.
+
+ * docs/b3/intermediate-representation.html:
+
2016-10-21 Keith Miller <keith_mil...@apple.com>
Expand Trunc in B3 to support Double to Float
Modified: trunk/Websites/webkit.org/docs/b3/intermediate-representation.html (208854 => 208855)
--- trunk/Websites/webkit.org/docs/b3/intermediate-representation.html 2016-11-17 19:07:31 UTC (rev 208854)
+++ trunk/Websites/webkit.org/docs/b3/intermediate-representation.html 2016-11-17 19:21:42 UTC (rev 208855)
@@ -280,6 +280,16 @@
always Int32. Only the low 31 bits of the shift amount are used for Int32. Only the
low 63 bits of the shift amount are used for Int64.</dd>
+ <dt>T RotR(T, Int32)</dt>
+ <dd>Rotate right. Valid for Int32 and Int64. The shift amount is always Int32. Only the
+ low 31 bits of the shift amount are used for Int32. Only the low 63 bits of the shift
+ amount are used for Int64.</dd>
+
+ <dt>T RotL(T, Int32)</dt>
+ <dd>Rotate left. Valid for Int32 and Int64. The shift amount is always Int32. Only the
+ low 31 bits of the shift amount are used for Int32. Only the low 63 bits of the shift
+ amount are used for Int64.</dd>
+
<dt>T Clz(T)</dt>
<dd>Count leading zeroes. Valid for Int32 and Int64.</dd>