OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 case kPPC_DoubleToUint32: | 1159 case kPPC_DoubleToUint32: |
1160 case kPPC_DoubleToInt64: | 1160 case kPPC_DoubleToInt64: |
1161 __ ConvertDoubleToInt64(i.InputDoubleRegister(0), | 1161 __ ConvertDoubleToInt64(i.InputDoubleRegister(0), |
1162 #if !V8_TARGET_ARCH_PPC64 | 1162 #if !V8_TARGET_ARCH_PPC64 |
1163 kScratchReg, | 1163 kScratchReg, |
1164 #endif | 1164 #endif |
1165 i.OutputRegister(), kScratchDoubleReg); | 1165 i.OutputRegister(), kScratchDoubleReg); |
1166 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 1166 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
1167 break; | 1167 break; |
1168 #if V8_TARGET_ARCH_PPC64 | 1168 #if V8_TARGET_ARCH_PPC64 |
1169 case kPPC_DoubleToUint64: | 1169 case kPPC_DoubleToUint64: { |
| 1170 bool check_conversion = (i.OutputCount() > 1); |
| 1171 if (check_conversion) { |
| 1172 __ mtfsb0(VXCVI); // clear FPSCR:VXCVI bit |
| 1173 } |
1170 __ ConvertDoubleToUnsignedInt64(i.InputDoubleRegister(0), | 1174 __ ConvertDoubleToUnsignedInt64(i.InputDoubleRegister(0), |
1171 i.OutputRegister(), kScratchDoubleReg); | 1175 i.OutputRegister(0), kScratchDoubleReg); |
| 1176 if (check_conversion) { |
| 1177 // Set 2nd output to zero if conversion fails. |
| 1178 CRBit crbit = static_cast<CRBit>(VXCVI % CRWIDTH); |
| 1179 __ mcrfs(cr7, VXCVI); // extract FPSCR field containing VXCVI into cr7 |
| 1180 __ li(i.OutputRegister(1), Operand(1)); |
| 1181 __ isel(i.OutputRegister(1), r0, i.OutputRegister(1), |
| 1182 v8::internal::Assembler::encode_crbit(cr7, crbit)); |
| 1183 } |
1172 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 1184 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
1173 break; | 1185 break; |
| 1186 } |
1174 #endif | 1187 #endif |
1175 case kPPC_DoubleToFloat32: | 1188 case kPPC_DoubleToFloat32: |
1176 ASSEMBLE_FLOAT_UNOP_RC(frsp); | 1189 ASSEMBLE_FLOAT_UNOP_RC(frsp); |
1177 break; | 1190 break; |
1178 case kPPC_Float32ToDouble: | 1191 case kPPC_Float32ToDouble: |
1179 // Nothing to do. | 1192 // Nothing to do. |
1180 __ Move(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); | 1193 __ Move(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); |
1181 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 1194 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
1182 break; | 1195 break; |
1183 case kPPC_DoubleExtractLowWord32: | 1196 case kPPC_DoubleExtractLowWord32: |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 padding_size -= v8::internal::Assembler::kInstrSize; | 1783 padding_size -= v8::internal::Assembler::kInstrSize; |
1771 } | 1784 } |
1772 } | 1785 } |
1773 } | 1786 } |
1774 | 1787 |
1775 #undef __ | 1788 #undef __ |
1776 | 1789 |
1777 } // namespace compiler | 1790 } // namespace compiler |
1778 } // namespace internal | 1791 } // namespace internal |
1779 } // namespace v8 | 1792 } // namespace v8 |
OLD | NEW |