Index: src/compiler/wasm-compiler.cc |
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
index 2b75b0a60e5e6f17a26b75727ac5f60d51c0f485..245d921b9da6fef6aa1eab16fa345c0777fa4aa3 100644 |
--- a/src/compiler/wasm-compiler.cc |
+++ b/src/compiler/wasm-compiler.cc |
@@ -842,6 +842,21 @@ Node* WasmGraphBuilder::Unop(wasm::WasmOpcode opcode, Node* input) { |
op = m->Word64Clz(); |
break; |
// kExprI64Ctz: |
+ case wasm::kExprI64Ctz: { |
+ if (m->Word64Ctz().IsSupported()) { |
+ op = m->Word64Ctz().op(); |
+ break; |
+ } else if (m->Is32() && m->Word32Ctz().IsSupported()) { |
+ op = m->Word64CtzPlaceholder(); |
+ break; |
+ } else if (m->Word64ReverseBits().IsSupported()) { |
+ Node* reversed = graph()->NewNode(m->Word64ReverseBits().op(), input); |
+ Node* result = graph()->NewNode(m->Word64Clz(), reversed); |
+ return result; |
+ } else { |
+ return BuildI64Ctz(input); |
+ } |
+ } |
// kExprI64Popcnt: |
case wasm::kExprI64Popcnt: { |
if (m->Word64Popcnt().IsSupported()) { |
@@ -900,22 +915,6 @@ Node* WasmGraphBuilder::Unop(wasm::WasmOpcode opcode, Node* input) { |
case wasm::kExprI64UConvertF64: { |
return BuildI64UConvertF64(input); |
} |
-#if WASM_64 |
- // Opcodes only supported on 64-bit platforms. |
- // TODO(titzer): query the machine operator builder here instead of #ifdef. |
- case wasm::kExprI64Ctz: { |
- if (m->Word64Ctz().IsSupported()) { |
- op = m->Word64Ctz().op(); |
- break; |
- } else if (m->Word64ReverseBits().IsSupported()) { |
- Node* reversed = graph()->NewNode(m->Word64ReverseBits().op(), input); |
- Node* result = graph()->NewNode(m->Word64Clz(), reversed); |
- return result; |
- } else { |
- return BuildI64Ctz(input); |
- } |
- } |
-#endif |
default: |
op = UnsupportedOpcode(opcode); |
} |