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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 } | 1050 } |
1051 case kMips64TruncWD: { | 1051 case kMips64TruncWD: { |
1052 FPURegister scratch = kScratchDoubleReg; | 1052 FPURegister scratch = kScratchDoubleReg; |
1053 // Other arches use round to zero here, so we follow. | 1053 // Other arches use round to zero here, so we follow. |
1054 __ trunc_w_d(scratch, i.InputDoubleRegister(0)); | 1054 __ trunc_w_d(scratch, i.InputDoubleRegister(0)); |
1055 __ mfc1(i.OutputRegister(), scratch); | 1055 __ mfc1(i.OutputRegister(), scratch); |
1056 break; | 1056 break; |
1057 } | 1057 } |
1058 case kMips64TruncLS: { | 1058 case kMips64TruncLS: { |
1059 FPURegister scratch = kScratchDoubleReg; | 1059 FPURegister scratch = kScratchDoubleReg; |
| 1060 Register tmp_fcsr = kScratchReg; |
| 1061 Register result = kScratchReg2; |
| 1062 |
| 1063 bool load_status = instr->OutputCount() > 1; |
| 1064 if (load_status) { |
| 1065 // Save FCSR. |
| 1066 __ cfc1(tmp_fcsr, FCSR); |
| 1067 // Clear FPU flags. |
| 1068 __ ctc1(zero_reg, FCSR); |
| 1069 } |
1060 // Other arches use round to zero here, so we follow. | 1070 // Other arches use round to zero here, so we follow. |
1061 __ trunc_l_s(scratch, i.InputDoubleRegister(0)); | 1071 __ trunc_l_s(scratch, i.InputDoubleRegister(0)); |
1062 __ dmfc1(i.OutputRegister(), scratch); | 1072 __ dmfc1(i.OutputRegister(), scratch); |
| 1073 if (load_status) { |
| 1074 __ cfc1(result, FCSR); |
| 1075 // Check for overflow and NaNs. |
| 1076 __ andi(result, result, |
| 1077 (kFCSROverflowFlagMask | kFCSRInvalidOpFlagMask)); |
| 1078 __ Slt(result, zero_reg, result); |
| 1079 __ xori(result, result, 1); |
| 1080 __ mov(i.OutputRegister(1), result); |
| 1081 // Restore FCSR |
| 1082 __ ctc1(tmp_fcsr, FCSR); |
| 1083 } |
1063 break; | 1084 break; |
1064 } | 1085 } |
1065 case kMips64TruncLD: { | 1086 case kMips64TruncLD: { |
1066 FPURegister scratch = kScratchDoubleReg; | 1087 FPURegister scratch = kScratchDoubleReg; |
1067 Register tmp_fcsr = kScratchReg; | 1088 Register tmp_fcsr = kScratchReg; |
1068 Register result = kScratchReg2; | 1089 Register result = kScratchReg2; |
1069 | 1090 |
1070 bool load_status = instr->OutputCount() > 1; | 1091 bool load_status = instr->OutputCount() > 1; |
1071 if (load_status) { | 1092 if (load_status) { |
1072 // Save FCSR. | 1093 // Save FCSR. |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 padding_size -= v8::internal::Assembler::kInstrSize; | 1847 padding_size -= v8::internal::Assembler::kInstrSize; |
1827 } | 1848 } |
1828 } | 1849 } |
1829 } | 1850 } |
1830 | 1851 |
1831 #undef __ | 1852 #undef __ |
1832 | 1853 |
1833 } // namespace compiler | 1854 } // namespace compiler |
1834 } // namespace internal | 1855 } // namespace internal |
1835 } // namespace v8 | 1856 } // namespace v8 |
OLD | NEW |