| OLD | NEW | 
|---|
| 1 // Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file | 
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a | 
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "vm/globals.h"  // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h"  // Needed here to get TARGET_ARCH_ARM. | 
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) | 
| 7 | 7 | 
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" | 
| 9 | 9 | 
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" | 
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 117     case EQ: return NE; | 117     case EQ: return NE; | 
| 118     case NE: return EQ; | 118     case NE: return EQ; | 
| 119     case LT: return GE; | 119     case LT: return GE; | 
| 120     case LE: return GT; | 120     case LE: return GT; | 
| 121     case GT: return LE; | 121     case GT: return LE; | 
| 122     case GE: return LT; | 122     case GE: return LT; | 
| 123     case CC: return CS; | 123     case CC: return CS; | 
| 124     case LS: return HI; | 124     case LS: return HI; | 
| 125     case HI: return LS; | 125     case HI: return LS; | 
| 126     case CS: return CC; | 126     case CS: return CC; | 
|  | 127     case VC: return VS; | 
|  | 128     case VS: return VC; | 
| 127     default: | 129     default: | 
| 128       UNREACHABLE(); | 130       UNREACHABLE(); | 
| 129       return EQ; | 131       return EQ; | 
| 130   } | 132   } | 
| 131 } | 133 } | 
| 132 | 134 | 
| 133 | 135 | 
| 134 // Detect pattern when one value is zero and another is a power of 2. | 136 // Detect pattern when one value is zero and another is a power of 2. | 
| 135 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { | 137 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { | 
| 136   return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || | 138   return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || | 
| (...skipping 4010 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4147   const intptr_t kNumInputs = 1; | 4149   const intptr_t kNumInputs = 1; | 
| 4148   const intptr_t kNumTemps = 0; | 4150   const intptr_t kNumTemps = 0; | 
| 4149   LocationSummary* summary = new(zone) LocationSummary( | 4151   LocationSummary* summary = new(zone) LocationSummary( | 
| 4150       zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4152       zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 
| 4151   summary->set_in(0, Location::RequiresFpuRegister()); | 4153   summary->set_in(0, Location::RequiresFpuRegister()); | 
| 4152   summary->set_out(0, Location::RequiresRegister()); | 4154   summary->set_out(0, Location::RequiresRegister()); | 
| 4153   return summary; | 4155   return summary; | 
| 4154 } | 4156 } | 
| 4155 | 4157 | 
| 4156 | 4158 | 
| 4157 void DoubleTestOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4159 Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, | 
| 4158   ASSERT(compiler->is_optimizing()); | 4160                                                 BranchLabels labels) { | 
| 4159   const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 4161   const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 
| 4160   const Register result = locs()->out(0).reg(); | 4162   const Register result = locs()->out(0).reg(); | 
|  | 4163   const bool is_negated = kind() != Token::kEQ; | 
| 4161   if (op_kind() == MethodRecognizer::kDouble_getIsNaN) { | 4164   if (op_kind() == MethodRecognizer::kDouble_getIsNaN) { | 
| 4162     __ LoadObject(result, Bool::False()); |  | 
| 4163     __ vcmpd(value, value); | 4165     __ vcmpd(value, value); | 
| 4164     __ vmstat(); | 4166     __ vmstat(); | 
| 4165     __ LoadObject(result, Bool::True(), VS); | 4167     return is_negated ? VC : VS; | 
| 4166   } else { | 4168   } else { | 
| 4167     ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite); | 4169     ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite); | 
| 4168     Label done; | 4170     Label done; | 
| 4169     // TMP <- value[0:31], result <- value[32:63] | 4171     // TMP <- value[0:31], result <- value[32:63] | 
| 4170     __ vmovrrd(TMP, result, value); | 4172     __ vmovrrd(TMP, result, value); | 
| 4171     __ cmp(TMP, Operand(0)); | 4173     __ cmp(TMP, Operand(0)); | 
| 4172     __ LoadObject(result, Bool::False(), NE); | 4174     __ b(is_negated ? labels.true_label : labels.false_label, NE); | 
| 4173     __ b(&done, NE); |  | 
| 4174 | 4175 | 
| 4175     // Mask off the sign bit. | 4176     // Mask off the sign bit. | 
| 4176     __ AndImmediate(result, result, 0x7FFFFFFF); | 4177     __ AndImmediate(result, result, 0x7FFFFFFF); | 
| 4177     // Compare with +infinity. | 4178     // Compare with +infinity. | 
| 4178     __ CompareImmediate(result, 0x7FF00000); | 4179     __ CompareImmediate(result, 0x7FF00000); | 
| 4179     __ LoadObject(result, Bool::False(), NE); | 4180     return is_negated ? NE : EQ; | 
| 4180     __ b(&done, NE); | 4181   } | 
|  | 4182 } | 
| 4181 | 4183 | 
|  | 4184 void DoubleTestOpInstr::EmitBranchCode(FlowGraphCompiler* compiler, | 
|  | 4185                                        BranchInstr* branch) { | 
|  | 4186   ASSERT(compiler->is_optimizing()); | 
|  | 4187   BranchLabels labels = compiler->CreateBranchLabels(branch); | 
|  | 4188   Condition true_condition = EmitComparisonCode(compiler, labels); | 
|  | 4189   EmitBranchOnCondition(compiler, true_condition, labels); | 
|  | 4190 } | 
|  | 4191 | 
|  | 4192 | 
|  | 4193 void DoubleTestOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 
|  | 4194   ASSERT(compiler->is_optimizing()); | 
|  | 4195   Label is_true, is_false; | 
|  | 4196   BranchLabels labels = { &is_true, &is_false, &is_false }; | 
|  | 4197   Condition true_condition = EmitComparisonCode(compiler, labels); | 
|  | 4198   const Register result = locs()->out(0).reg(); | 
|  | 4199   if (op_kind() == MethodRecognizer::kDouble_getIsNaN) { | 
|  | 4200     __ LoadObject(result, Bool::True(), true_condition); | 
|  | 4201     __ LoadObject(result, Bool::False(), NegateCondition(true_condition)); | 
|  | 4202   } else { | 
|  | 4203     ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite); | 
|  | 4204     EmitBranchOnCondition(compiler, true_condition, labels); | 
|  | 4205     Label done; | 
|  | 4206     __ Bind(&is_false); | 
|  | 4207     __ LoadObject(result, Bool::False()); | 
|  | 4208     __ b(&done); | 
|  | 4209     __ Bind(&is_true); | 
| 4182     __ LoadObject(result, Bool::True()); | 4210     __ LoadObject(result, Bool::True()); | 
| 4183     __ Bind(&done); | 4211     __ Bind(&done); | 
| 4184   } | 4212   } | 
| 4185 } | 4213 } | 
| 4186 | 4214 | 
| 4187 | 4215 | 
| 4188 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, | 4216 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, | 
| 4189                                                              bool opt) const { | 4217                                                              bool opt) const { | 
| 4190   const intptr_t kNumInputs = 2; | 4218   const intptr_t kNumInputs = 2; | 
| 4191   const intptr_t kNumTemps = 0; | 4219   const intptr_t kNumTemps = 0; | 
| (...skipping 2868 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7060                                 1, | 7088                                 1, | 
| 7061                                 locs()); | 7089                                 locs()); | 
| 7062   __ Drop(1); | 7090   __ Drop(1); | 
| 7063   __ Pop(result); | 7091   __ Pop(result); | 
| 7064 } | 7092 } | 
| 7065 | 7093 | 
| 7066 | 7094 | 
| 7067 }  // namespace dart | 7095 }  // namespace dart | 
| 7068 | 7096 | 
| 7069 #endif  // defined TARGET_ARCH_ARM | 7097 #endif  // defined TARGET_ARCH_ARM | 
| OLD | NEW | 
|---|