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/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 #include "src/compiler/code-generator.h" | 6 #include "src/compiler/code-generator.h" |
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 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 } | 1072 } |
1073 case kMips64TruncWD: { | 1073 case kMips64TruncWD: { |
1074 FPURegister scratch = kScratchDoubleReg; | 1074 FPURegister scratch = kScratchDoubleReg; |
1075 // Other arches use round to zero here, so we follow. | 1075 // Other arches use round to zero here, so we follow. |
1076 __ trunc_w_d(scratch, i.InputDoubleRegister(0)); | 1076 __ trunc_w_d(scratch, i.InputDoubleRegister(0)); |
1077 __ mfc1(i.OutputRegister(), scratch); | 1077 __ mfc1(i.OutputRegister(), scratch); |
1078 break; | 1078 break; |
1079 } | 1079 } |
1080 case kMips64TruncLS: { | 1080 case kMips64TruncLS: { |
1081 FPURegister scratch = kScratchDoubleReg; | 1081 FPURegister scratch = kScratchDoubleReg; |
| 1082 Register tmp_fcsr = kScratchReg; |
| 1083 Register result = kScratchReg2; |
| 1084 |
| 1085 bool load_status = instr->OutputCount() > 1; |
| 1086 if (load_status) { |
| 1087 // Save FCSR. |
| 1088 __ cfc1(tmp_fcsr, FCSR); |
| 1089 // Clear FPU flags. |
| 1090 __ ctc1(zero_reg, FCSR); |
| 1091 } |
1082 // Other arches use round to zero here, so we follow. | 1092 // Other arches use round to zero here, so we follow. |
1083 __ trunc_l_s(scratch, i.InputDoubleRegister(0)); | 1093 __ trunc_l_s(scratch, i.InputDoubleRegister(0)); |
1084 __ dmfc1(i.OutputRegister(), scratch); | 1094 __ dmfc1(i.OutputRegister(), scratch); |
| 1095 if (load_status) { |
| 1096 __ cfc1(result, FCSR); |
| 1097 // Check for overflow and NaNs. |
| 1098 __ andi(result, result, |
| 1099 (kFCSROverflowFlagMask | kFCSRInvalidOpFlagMask)); |
| 1100 __ Slt(result, zero_reg, result); |
| 1101 __ xori(result, result, 1); |
| 1102 __ mov(i.OutputRegister(1), result); |
| 1103 // Restore FCSR |
| 1104 __ ctc1(tmp_fcsr, FCSR); |
| 1105 } |
1085 break; | 1106 break; |
1086 } | 1107 } |
1087 case kMips64TruncLD: { | 1108 case kMips64TruncLD: { |
1088 FPURegister scratch = kScratchDoubleReg; | 1109 FPURegister scratch = kScratchDoubleReg; |
1089 Register tmp_fcsr = kScratchReg; | 1110 Register tmp_fcsr = kScratchReg; |
1090 Register result = kScratchReg2; | 1111 Register result = kScratchReg2; |
1091 | 1112 |
1092 bool load_status = instr->OutputCount() > 1; | 1113 bool load_status = instr->OutputCount() > 1; |
1093 if (load_status) { | 1114 if (load_status) { |
1094 // Save FCSR. | 1115 // Save FCSR. |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 padding_size -= v8::internal::Assembler::kInstrSize; | 1871 padding_size -= v8::internal::Assembler::kInstrSize; |
1851 } | 1872 } |
1852 } | 1873 } |
1853 } | 1874 } |
1854 | 1875 |
1855 #undef __ | 1876 #undef __ |
1856 | 1877 |
1857 } // namespace compiler | 1878 } // namespace compiler |
1858 } // namespace internal | 1879 } // namespace internal |
1859 } // namespace v8 | 1880 } // namespace v8 |
OLD | NEW |