OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 private: | 159 private: |
160 Register const result_; | 160 Register const result_; |
161 }; | 161 }; |
162 | 162 |
163 | 163 |
164 class OutOfLineLoadNaN final : public OutOfLineCode { | 164 class OutOfLineLoadNaN final : public OutOfLineCode { |
165 public: | 165 public: |
166 OutOfLineLoadNaN(CodeGenerator* gen, XMMRegister result) | 166 OutOfLineLoadNaN(CodeGenerator* gen, XMMRegister result) |
167 : OutOfLineCode(gen), result_(result) {} | 167 : OutOfLineCode(gen), result_(result) {} |
168 | 168 |
169 void Generate() final { __ pcmpeqd(result_, result_); } | 169 void Generate() final { __ Pcmpeqd(result_, result_); } |
170 | 170 |
171 private: | 171 private: |
172 XMMRegister const result_; | 172 XMMRegister const result_; |
173 }; | 173 }; |
174 | 174 |
175 | 175 |
176 class OutOfLineTruncateDoubleToI final : public OutOfLineCode { | 176 class OutOfLineTruncateDoubleToI final : public OutOfLineCode { |
177 public: | 177 public: |
178 OutOfLineTruncateDoubleToI(CodeGenerator* gen, Register result, | 178 OutOfLineTruncateDoubleToI(CodeGenerator* gen, Register result, |
179 XMMRegister input) | 179 XMMRegister input) |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 int32_t length) \ | 328 int32_t length) \ |
329 : OutOfLineCode(gen), \ | 329 : OutOfLineCode(gen), \ |
330 result_(result), \ | 330 result_(result), \ |
331 buffer_(buffer), \ | 331 buffer_(buffer), \ |
332 index1_(index1), \ | 332 index1_(index1), \ |
333 index2_(index2), \ | 333 index2_(index2), \ |
334 length_(length) {} \ | 334 length_(length) {} \ |
335 \ | 335 \ |
336 void Generate() final { \ | 336 void Generate() final { \ |
337 __ leal(kScratchRegister, Operand(index1_, index2_)); \ | 337 __ leal(kScratchRegister, Operand(index1_, index2_)); \ |
338 __ pcmpeqd(result_, result_); \ | 338 __ Pcmpeqd(result_, result_); \ |
339 __ cmpl(kScratchRegister, Immediate(length_)); \ | 339 __ cmpl(kScratchRegister, Immediate(length_)); \ |
340 __ j(above_equal, exit()); \ | 340 __ j(above_equal, exit()); \ |
341 __ asm_instr(result_, \ | 341 __ asm_instr(result_, \ |
342 Operand(buffer_, kScratchRegister, times_1, 0)); \ | 342 Operand(buffer_, kScratchRegister, times_1, 0)); \ |
343 } \ | 343 } \ |
344 \ | 344 \ |
345 private: \ | 345 private: \ |
346 XMMRegister const result_; \ | 346 XMMRegister const result_; \ |
347 Register const buffer_; \ | 347 Register const buffer_; \ |
348 Register const index1_; \ | 348 Register const index1_; \ |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 __ Movapd(i.OutputDoubleRegister(), i.OutputDoubleRegister()); | 1037 __ Movapd(i.OutputDoubleRegister(), i.OutputDoubleRegister()); |
1038 break; | 1038 break; |
1039 case kAVXFloat64Max: | 1039 case kAVXFloat64Max: |
1040 ASSEMBLE_AVX_BINOP(vmaxsd); | 1040 ASSEMBLE_AVX_BINOP(vmaxsd); |
1041 break; | 1041 break; |
1042 case kAVXFloat64Min: | 1042 case kAVXFloat64Min: |
1043 ASSEMBLE_AVX_BINOP(vminsd); | 1043 ASSEMBLE_AVX_BINOP(vminsd); |
1044 break; | 1044 break; |
1045 case kAVXFloat32Abs: { | 1045 case kAVXFloat32Abs: { |
1046 // TODO(bmeurer): Use RIP relative 128-bit constants. | 1046 // TODO(bmeurer): Use RIP relative 128-bit constants. |
1047 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); | |
1048 __ psrlq(kScratchDoubleReg, 33); | |
1049 CpuFeatureScope avx_scope(masm(), AVX); | 1047 CpuFeatureScope avx_scope(masm(), AVX); |
| 1048 __ vpcmpeqd(kScratchDoubleReg, kScratchDoubleReg, kScratchDoubleReg); |
| 1049 __ vpsrlq(kScratchDoubleReg, kScratchDoubleReg, 33); |
1050 if (instr->InputAt(0)->IsDoubleRegister()) { | 1050 if (instr->InputAt(0)->IsDoubleRegister()) { |
1051 __ vandps(i.OutputDoubleRegister(), kScratchDoubleReg, | 1051 __ vandps(i.OutputDoubleRegister(), kScratchDoubleReg, |
1052 i.InputDoubleRegister(0)); | 1052 i.InputDoubleRegister(0)); |
1053 } else { | 1053 } else { |
1054 __ vandps(i.OutputDoubleRegister(), kScratchDoubleReg, | 1054 __ vandps(i.OutputDoubleRegister(), kScratchDoubleReg, |
1055 i.InputOperand(0)); | 1055 i.InputOperand(0)); |
1056 } | 1056 } |
1057 break; | 1057 break; |
1058 } | 1058 } |
1059 case kAVXFloat32Neg: { | 1059 case kAVXFloat32Neg: { |
1060 // TODO(bmeurer): Use RIP relative 128-bit constants. | 1060 // TODO(bmeurer): Use RIP relative 128-bit constants. |
1061 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); | |
1062 __ psllq(kScratchDoubleReg, 31); | |
1063 CpuFeatureScope avx_scope(masm(), AVX); | 1061 CpuFeatureScope avx_scope(masm(), AVX); |
| 1062 __ vpcmpeqd(kScratchDoubleReg, kScratchDoubleReg, kScratchDoubleReg); |
| 1063 __ vpsllq(kScratchDoubleReg, kScratchDoubleReg, 31); |
1064 if (instr->InputAt(0)->IsDoubleRegister()) { | 1064 if (instr->InputAt(0)->IsDoubleRegister()) { |
1065 __ vxorps(i.OutputDoubleRegister(), kScratchDoubleReg, | 1065 __ vxorps(i.OutputDoubleRegister(), kScratchDoubleReg, |
1066 i.InputDoubleRegister(0)); | 1066 i.InputDoubleRegister(0)); |
1067 } else { | 1067 } else { |
1068 __ vxorps(i.OutputDoubleRegister(), kScratchDoubleReg, | 1068 __ vxorps(i.OutputDoubleRegister(), kScratchDoubleReg, |
1069 i.InputOperand(0)); | 1069 i.InputOperand(0)); |
1070 } | 1070 } |
1071 break; | 1071 break; |
1072 } | 1072 } |
1073 case kAVXFloat64Abs: { | 1073 case kAVXFloat64Abs: { |
1074 // TODO(bmeurer): Use RIP relative 128-bit constants. | 1074 // TODO(bmeurer): Use RIP relative 128-bit constants. |
1075 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); | |
1076 __ psrlq(kScratchDoubleReg, 1); | |
1077 CpuFeatureScope avx_scope(masm(), AVX); | 1075 CpuFeatureScope avx_scope(masm(), AVX); |
| 1076 __ vpcmpeqd(kScratchDoubleReg, kScratchDoubleReg, kScratchDoubleReg); |
| 1077 __ vpsrlq(kScratchDoubleReg, kScratchDoubleReg, 1); |
1078 if (instr->InputAt(0)->IsDoubleRegister()) { | 1078 if (instr->InputAt(0)->IsDoubleRegister()) { |
1079 __ vandpd(i.OutputDoubleRegister(), kScratchDoubleReg, | 1079 __ vandpd(i.OutputDoubleRegister(), kScratchDoubleReg, |
1080 i.InputDoubleRegister(0)); | 1080 i.InputDoubleRegister(0)); |
1081 } else { | 1081 } else { |
1082 __ vandpd(i.OutputDoubleRegister(), kScratchDoubleReg, | 1082 __ vandpd(i.OutputDoubleRegister(), kScratchDoubleReg, |
1083 i.InputOperand(0)); | 1083 i.InputOperand(0)); |
1084 } | 1084 } |
1085 break; | 1085 break; |
1086 } | 1086 } |
1087 case kAVXFloat64Neg: { | 1087 case kAVXFloat64Neg: { |
1088 // TODO(bmeurer): Use RIP relative 128-bit constants. | 1088 // TODO(bmeurer): Use RIP relative 128-bit constants. |
1089 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); | |
1090 __ psllq(kScratchDoubleReg, 63); | |
1091 CpuFeatureScope avx_scope(masm(), AVX); | 1089 CpuFeatureScope avx_scope(masm(), AVX); |
| 1090 __ vpcmpeqd(kScratchDoubleReg, kScratchDoubleReg, kScratchDoubleReg); |
| 1091 __ vpsllq(kScratchDoubleReg, kScratchDoubleReg, 63); |
1092 if (instr->InputAt(0)->IsDoubleRegister()) { | 1092 if (instr->InputAt(0)->IsDoubleRegister()) { |
1093 __ vxorpd(i.OutputDoubleRegister(), kScratchDoubleReg, | 1093 __ vxorpd(i.OutputDoubleRegister(), kScratchDoubleReg, |
1094 i.InputDoubleRegister(0)); | 1094 i.InputDoubleRegister(0)); |
1095 } else { | 1095 } else { |
1096 __ vxorpd(i.OutputDoubleRegister(), kScratchDoubleReg, | 1096 __ vxorpd(i.OutputDoubleRegister(), kScratchDoubleReg, |
1097 i.InputOperand(0)); | 1097 i.InputOperand(0)); |
1098 } | 1098 } |
1099 break; | 1099 break; |
1100 } | 1100 } |
1101 case kX64Movsxbl: | 1101 case kX64Movsxbl: |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 1831 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
1832 __ Nop(padding_size); | 1832 __ Nop(padding_size); |
1833 } | 1833 } |
1834 } | 1834 } |
1835 | 1835 |
1836 #undef __ | 1836 #undef __ |
1837 | 1837 |
1838 } // namespace compiler | 1838 } // namespace compiler |
1839 } // namespace internal | 1839 } // namespace internal |
1840 } // namespace v8 | 1840 } // namespace v8 |
OLD | NEW |