[wasm] Add simd lowering for I16x8Neg

BUG=

Review-Url: https://codereview.chromium.org/2861113002
Cr-Commit-Position: refs/heads/master@{#45320}
This commit is contained in:
dusan.simicic 2017-05-15 14:43:55 -07:00 committed by Commit bot
parent 7a581fa28f
commit 35c850e5c5
2 changed files with 13 additions and 6 deletions

View File

@ -834,15 +834,20 @@ void SimdScalarLowering::LowerNode(Node* node) {
LowerIntMinMax(node, machine()->Uint32LessThan(), false, rep_type);
break;
}
case IrOpcode::kI32x4Neg: {
case IrOpcode::kI32x4Neg:
case IrOpcode::kI16x8Neg: {
DCHECK(node->InputCount() == 1);
Node** rep = GetReplacementsWithType(node->InputAt(0), rep_type);
Node* rep_node[kNumLanes32];
int num_lanes = NumLanes(rep_type);
Node** rep_node = zone()->NewArray<Node*>(num_lanes);
Node* zero = graph()->NewNode(common()->Int32Constant(0));
for (int i = 0; i < kNumLanes32; ++i) {
for (int i = 0; i < num_lanes; ++i) {
rep_node[i] = graph()->NewNode(machine()->Int32Sub(), zero, rep[i]);
if (node->opcode() == IrOpcode::kI16x8Neg) {
rep_node[i] = FixUpperBits(rep_node[i], kShift16);
}
}
ReplaceNode(node, rep_node, kNumLanes32);
ReplaceNode(node, rep_node, num_lanes);
break;
}
case IrOpcode::kS128Not: {

View File

@ -1161,7 +1161,8 @@ WASM_EXEC_COMPILED_TEST(I16x8ConvertI8x16) {
}
#endif // V8_TARGET_ARCH_ARM
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
#if SIMD_LOWERING_TARGET || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || \
V8_TARGET_ARCH_MIPS64
void RunI16x8UnOpTest(WasmOpcode simd_op, Int16UnOp expected_op) {
FLAG_wasm_simd_prototype = true;
WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);
@ -1176,7 +1177,8 @@ void RunI16x8UnOpTest(WasmOpcode simd_op, Int16UnOp expected_op) {
}
WASM_EXEC_COMPILED_TEST(I16x8Neg) { RunI16x8UnOpTest(kExprI16x8Neg, Negate); }
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
#endif // SIMD_LOWERING_TARGET || V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64
#if V8_TARGET_ARCH_ARM
// Tests both signed and unsigned conversion from I32x4 (packing).