Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(792)

Side by Side Diff: src/compiler/wasm-compiler.cc

Issue 2215403002: [turbofan] Make Float32Neg and Float64Neg mandatory operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/wasm-compiler.h" 5 #include "src/compiler/wasm-compiler.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 10
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 const Operator* op; 646 const Operator* op;
647 MachineOperatorBuilder* m = jsgraph()->machine(); 647 MachineOperatorBuilder* m = jsgraph()->machine();
648 switch (opcode) { 648 switch (opcode) {
649 case wasm::kExprI32Eqz: 649 case wasm::kExprI32Eqz:
650 op = m->Word32Equal(); 650 op = m->Word32Equal();
651 return graph()->NewNode(op, input, jsgraph()->Int32Constant(0)); 651 return graph()->NewNode(op, input, jsgraph()->Int32Constant(0));
652 case wasm::kExprF32Abs: 652 case wasm::kExprF32Abs:
653 op = m->Float32Abs(); 653 op = m->Float32Abs();
654 break; 654 break;
655 case wasm::kExprF32Neg: { 655 case wasm::kExprF32Neg: {
656 if (m->Float32Neg().IsSupported()) { 656 op = m->Float32Neg();
657 op = m->Float32Neg().op(); 657 break;
658 break;
659 } else {
660 return BuildF32Neg(input);
661 }
662 } 658 }
663 case wasm::kExprF32Sqrt: 659 case wasm::kExprF32Sqrt:
664 op = m->Float32Sqrt(); 660 op = m->Float32Sqrt();
665 break; 661 break;
666 case wasm::kExprF64Abs: 662 case wasm::kExprF64Abs:
667 op = m->Float64Abs(); 663 op = m->Float64Abs();
668 break; 664 break;
669 case wasm::kExprF64Neg: { 665 case wasm::kExprF64Neg: {
670 if (m->Float64Neg().IsSupported()) { 666 op = m->Float64Neg();
671 op = m->Float64Neg().op(); 667 break;
672 break;
673 } else {
674 return BuildF64Neg(input);
675 }
676 } 668 }
677 case wasm::kExprF64Sqrt: 669 case wasm::kExprF64Sqrt:
678 op = m->Float64Sqrt(); 670 op = m->Float64Sqrt();
679 break; 671 break;
680 case wasm::kExprI32SConvertF64: 672 case wasm::kExprI32SConvertF64:
681 return BuildI32SConvertF64(input, position); 673 return BuildI32SConvertF64(input, position);
682 case wasm::kExprI32UConvertF64: 674 case wasm::kExprI32UConvertF64:
683 return BuildI32UConvertF64(input, position); 675 return BuildI32UConvertF64(input, position);
684 case wasm::kExprI32AsmjsSConvertF64: 676 case wasm::kExprI32AsmjsSConvertF64:
685 return BuildI32AsmjsSConvertF64(input); 677 return BuildI32AsmjsSConvertF64(input);
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 m->Word32Sar(), 1143 m->Word32Sar(),
1152 graph()->NewNode(m->Word32Shl(), result, shiftBitCount), 1144 graph()->NewNode(m->Word32Shl(), result, shiftBitCount),
1153 shiftBitCount); 1145 shiftBitCount);
1154 } 1146 }
1155 } 1147 }
1156 } 1148 }
1157 1149
1158 return result; 1150 return result;
1159 } 1151 }
1160 1152
1161 Node* WasmGraphBuilder::BuildF32Neg(Node* input) {
1162 Node* result =
1163 Unop(wasm::kExprF32ReinterpretI32,
1164 Binop(wasm::kExprI32Xor, Unop(wasm::kExprI32ReinterpretF32, input),
1165 jsgraph()->Int32Constant(0x80000000)));
1166
1167 return result;
1168 }
1169
1170 Node* WasmGraphBuilder::BuildF64Neg(Node* input) {
1171 #if WASM_64
1172 Node* result =
1173 Unop(wasm::kExprF64ReinterpretI64,
1174 Binop(wasm::kExprI64Xor, Unop(wasm::kExprI64ReinterpretF64, input),
1175 jsgraph()->Int64Constant(0x8000000000000000)));
1176
1177 return result;
1178 #else
1179 MachineOperatorBuilder* m = jsgraph()->machine();
1180
1181 Node* old_high_word = graph()->NewNode(m->Float64ExtractHighWord32(), input);
1182 Node* new_high_word = Binop(wasm::kExprI32Xor, old_high_word,
1183 jsgraph()->Int32Constant(0x80000000));
1184
1185 return graph()->NewNode(m->Float64InsertHighWord32(), input, new_high_word);
1186 #endif
1187 }
1188
1189 Node* WasmGraphBuilder::BuildF32CopySign(Node* left, Node* right) { 1153 Node* WasmGraphBuilder::BuildF32CopySign(Node* left, Node* right) {
1190 Node* result = Unop( 1154 Node* result = Unop(
1191 wasm::kExprF32ReinterpretI32, 1155 wasm::kExprF32ReinterpretI32,
1192 Binop(wasm::kExprI32Ior, 1156 Binop(wasm::kExprI32Ior,
1193 Binop(wasm::kExprI32And, Unop(wasm::kExprI32ReinterpretF32, left), 1157 Binop(wasm::kExprI32And, Unop(wasm::kExprI32ReinterpretF32, left),
1194 jsgraph()->Int32Constant(0x7fffffff)), 1158 jsgraph()->Int32Constant(0x7fffffff)),
1195 Binop(wasm::kExprI32And, Unop(wasm::kExprI32ReinterpretF32, right), 1159 Binop(wasm::kExprI32And, Unop(wasm::kExprI32ReinterpretF32, right),
1196 jsgraph()->Int32Constant(0x80000000)))); 1160 jsgraph()->Int32Constant(0x80000000))));
1197 1161
1198 return result; 1162 return result;
(...skipping 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after
3496 function_->code_start_offset), 3460 function_->code_start_offset),
3497 compile_ms); 3461 compile_ms);
3498 } 3462 }
3499 3463
3500 return code; 3464 return code;
3501 } 3465 }
3502 3466
3503 } // namespace compiler 3467 } // namespace compiler
3504 } // namespace internal 3468 } // namespace internal
3505 } // namespace v8 3469 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698