diff options
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/code_generator.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/code_generator.h | 6 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86_64.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/nodes.h | 20 | ||||
-rw-r--r-- | compiler/optimizing/ssa_builder.cc | 8 |
6 files changed, 27 insertions, 23 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index 561dcb731..787a170d0 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -628,7 +628,7 @@ void CodeGenerator::RecordPcInfo(HInstruction* instruction, ++i, DexRegisterLocation::Kind::kConstant, High32Bits(value)); DCHECK_LT(i, environment_size); } else if (current->IsDoubleConstant()) { - int64_t value = bit_cast<double, int64_t>(current->AsDoubleConstant()->GetValue()); + int64_t value = bit_cast<int64_t, double>(current->AsDoubleConstant()->GetValue()); stack_map_stream_.AddDexRegisterEntry( i, DexRegisterLocation::Kind::kConstant, Low32Bits(value)); stack_map_stream_.AddDexRegisterEntry( @@ -641,7 +641,7 @@ void CodeGenerator::RecordPcInfo(HInstruction* instruction, stack_map_stream_.AddDexRegisterEntry(i, DexRegisterLocation::Kind::kConstant, 0); } else { DCHECK(current->IsFloatConstant()) << current->DebugName(); - int32_t value = bit_cast<float, int32_t>(current->AsFloatConstant()->GetValue()); + int32_t value = bit_cast<int32_t, float>(current->AsFloatConstant()->GetValue()); stack_map_stream_.AddDexRegisterEntry(i, DexRegisterLocation::Kind::kConstant, value); } break; diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index ecaa6f012..07ca6b1cc 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -271,7 +271,7 @@ class CodeGenerator { return 0; } else { DCHECK(constant->IsFloatConstant()); - return bit_cast<float, int32_t>(constant->AsFloatConstant()->GetValue()); + return bit_cast<int32_t, float>(constant->AsFloatConstant()->GetValue()); } } @@ -281,12 +281,12 @@ class CodeGenerator { } else if (constant->IsNullConstant()) { return 0; } else if (constant->IsFloatConstant()) { - return bit_cast<float, int32_t>(constant->AsFloatConstant()->GetValue()); + return bit_cast<int32_t, float>(constant->AsFloatConstant()->GetValue()); } else if (constant->IsLongConstant()) { return constant->AsLongConstant()->GetValue(); } else { DCHECK(constant->IsDoubleConstant()); - return bit_cast<double, int64_t>(constant->AsDoubleConstant()->GetValue()); + return bit_cast<int64_t, double>(constant->AsDoubleConstant()->GetValue()); } } diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 02b9b3294..e808a122e 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -680,7 +680,7 @@ void CodeGeneratorX86::Move64(Location destination, Location source) { value = constant->AsLongConstant()->GetValue(); } else { DCHECK(constant->IsDoubleConstant()); - value = bit_cast<double, int64_t>(constant->AsDoubleConstant()->GetValue()); + value = bit_cast<int64_t, double>(constant->AsDoubleConstant()->GetValue()); } __ movl(Address(ESP, destination.GetStackIndex()), Immediate(Low32Bits(value))); __ movl(Address(ESP, destination.GetHighStackIndex(kX86WordSize)), Immediate(High32Bits(value))); @@ -3665,7 +3665,7 @@ void ParallelMoveResolverX86::EmitMove(size_t index) { } } else if (constant->IsFloatConstant()) { float fp_value = constant->AsFloatConstant()->GetValue(); - int32_t value = bit_cast<float, int32_t>(fp_value); + int32_t value = bit_cast<int32_t, float>(fp_value); Immediate imm(value); if (destination.IsFpuRegister()) { XmmRegister dest = destination.AsFpuRegister<XmmRegister>(); @@ -3699,7 +3699,7 @@ void ParallelMoveResolverX86::EmitMove(size_t index) { } else { DCHECK(constant->IsDoubleConstant()); double dbl_value = constant->AsDoubleConstant()->GetValue(); - int64_t value = bit_cast<double, int64_t>(dbl_value); + int64_t value = bit_cast<int64_t, double>(dbl_value); int32_t low_value = Low32Bits(value); int32_t high_value = High32Bits(value); Immediate low(low_value); diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index d09c8f8e5..b12f57ed7 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -625,7 +625,7 @@ void CodeGeneratorX86_64::Move(Location destination, Location source) { HConstant* constant = source.GetConstant(); int64_t value = constant->AsLongConstant()->GetValue(); if (constant->IsDoubleConstant()) { - value = bit_cast<double, int64_t>(constant->AsDoubleConstant()->GetValue()); + value = bit_cast<int64_t, double>(constant->AsDoubleConstant()->GetValue()); } else { DCHECK(constant->IsLongConstant()); value = constant->AsLongConstant()->GetValue(); @@ -3344,7 +3344,7 @@ void ParallelMoveResolverX86_64::EmitMove(size_t index) { } } else if (constant->IsFloatConstant()) { float fp_value = constant->AsFloatConstant()->GetValue(); - int32_t value = bit_cast<float, int32_t>(fp_value); + int32_t value = bit_cast<int32_t, float>(fp_value); Immediate imm(value); if (destination.IsFpuRegister()) { XmmRegister dest = destination.AsFpuRegister<XmmRegister>(); @@ -3362,7 +3362,7 @@ void ParallelMoveResolverX86_64::EmitMove(size_t index) { } else { DCHECK(constant->IsDoubleConstant()) << constant->DebugName(); double fp_value = constant->AsDoubleConstant()->GetValue(); - int64_t value = bit_cast<double, int64_t>(fp_value); + int64_t value = bit_cast<int64_t, double>(fp_value); Immediate imm(value); if (destination.IsFpuRegister()) { XmmRegister dest = destination.AsFpuRegister<XmmRegister>(); diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 07ff8ba01..df847aaab 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -1875,20 +1875,22 @@ class HFloatConstant : public HConstant { float GetValue() const { return value_; } bool InstructionDataEquals(HInstruction* other) const OVERRIDE { - return bit_cast<float, int32_t>(other->AsFloatConstant()->value_) == - bit_cast<float, int32_t>(value_); + return bit_cast<uint32_t, float>(other->AsFloatConstant()->value_) == + bit_cast<uint32_t, float>(value_); } size_t ComputeHashCode() const OVERRIDE { return static_cast<size_t>(GetValue()); } bool IsMinusOne() const OVERRIDE { - return bit_cast<uint32_t>(AsFloatConstant()->GetValue()) == bit_cast<uint32_t>((-1.0f)); + return bit_cast<uint32_t, float>(AsFloatConstant()->GetValue()) == + bit_cast<uint32_t, float>((-1.0f)); } bool IsZero() const OVERRIDE { return AsFloatConstant()->GetValue() == 0.0f; } bool IsOne() const OVERRIDE { - return bit_cast<uint32_t>(AsFloatConstant()->GetValue()) == bit_cast<uint32_t>(1.0f); + return bit_cast<uint32_t, float>(AsFloatConstant()->GetValue()) == + bit_cast<uint32_t, float>(1.0f); } DECLARE_INSTRUCTION(FloatConstant); @@ -1906,20 +1908,22 @@ class HDoubleConstant : public HConstant { double GetValue() const { return value_; } bool InstructionDataEquals(HInstruction* other) const OVERRIDE { - return bit_cast<double, int64_t>(other->AsDoubleConstant()->value_) == - bit_cast<double, int64_t>(value_); + return bit_cast<uint64_t, double>(other->AsDoubleConstant()->value_) == + bit_cast<uint64_t, double>(value_); } size_t ComputeHashCode() const OVERRIDE { return static_cast<size_t>(GetValue()); } bool IsMinusOne() const OVERRIDE { - return bit_cast<uint64_t>(AsDoubleConstant()->GetValue()) == bit_cast<uint64_t>((-1.0)); + return bit_cast<uint64_t, double>(AsDoubleConstant()->GetValue()) == + bit_cast<uint64_t, double>((-1.0)); } bool IsZero() const OVERRIDE { return AsDoubleConstant()->GetValue() == 0.0; } bool IsOne() const OVERRIDE { - return bit_cast<uint64_t>(AsDoubleConstant()->GetValue()) == bit_cast<uint64_t>(1.0); + return bit_cast<uint64_t, double>(AsDoubleConstant()->GetValue()) == + bit_cast<uint64_t, double>(1.0); } DECLARE_INSTRUCTION(DoubleConstant); diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc index ba11e90d9..ae6bf16f7 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -359,12 +359,12 @@ static HFloatConstant* GetFloatEquivalent(HIntConstant* constant) { if (result == nullptr) { HGraph* graph = constant->GetBlock()->GetGraph(); ArenaAllocator* allocator = graph->GetArena(); - result = new (allocator) HFloatConstant(bit_cast<int32_t, float>(constant->GetValue())); + result = new (allocator) HFloatConstant(bit_cast<float, int32_t>(constant->GetValue())); constant->GetBlock()->InsertInstructionBefore(result, constant->GetNext()); } else { // If there is already a constant with the expected type, we know it is // the floating point equivalent of this constant. - DCHECK_EQ((bit_cast<float, int32_t>(result->GetValue())), constant->GetValue()); + DCHECK_EQ((bit_cast<int32_t, float>(result->GetValue())), constant->GetValue()); } return result; } @@ -381,12 +381,12 @@ static HDoubleConstant* GetDoubleEquivalent(HLongConstant* constant) { if (result == nullptr) { HGraph* graph = constant->GetBlock()->GetGraph(); ArenaAllocator* allocator = graph->GetArena(); - result = new (allocator) HDoubleConstant(bit_cast<int64_t, double>(constant->GetValue())); + result = new (allocator) HDoubleConstant(bit_cast<double, int64_t>(constant->GetValue())); constant->GetBlock()->InsertInstructionBefore(result, constant->GetNext()); } else { // If there is already a constant with the expected type, we know it is // the floating point equivalent of this constant. - DCHECK_EQ((bit_cast<double, int64_t>(result->GetValue())), constant->GetValue()); + DCHECK_EQ((bit_cast<int64_t, double>(result->GetValue())), constant->GetValue()); } return result; } |