[art] fix -Wimplicit-int-float-conversion
kPrimIntMax cannot be precisely represented as an IEEE 754 single
precision float.
kPrimLongMax cannot be precisely represented as an IEEE 754 single
precision float or double precision double.
Accept the imprecision as per the local comments in the code.
Bug: 139945549
Test: mm
Change-Id: I598544fb2cd8904b321803ed04202ba0a694cdc1
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index 2d51f32..cd8c609 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -2906,7 +2906,7 @@
__ movl(output, Immediate(kPrimIntMax));
// if input >= (float)INT_MAX goto done
- __ comiss(input, codegen_->LiteralFloatAddress(kPrimIntMax));
+ __ comiss(input, codegen_->LiteralFloatAddress(static_cast<float>(kPrimIntMax)));
__ j(kAboveEqual, &done);
// if input == NaN goto nan
__ j(kUnordered, &nan);
@@ -2967,7 +2967,7 @@
codegen_->Load64BitValue(output, kPrimLongMax);
// if input >= (float)LONG_MAX goto done
- __ comiss(input, codegen_->LiteralFloatAddress(kPrimLongMax));
+ __ comiss(input, codegen_->LiteralFloatAddress(static_cast<float>(kPrimLongMax)));
__ j(kAboveEqual, &done);
// if input == NaN goto nan
__ j(kUnordered, &nan);
@@ -2988,7 +2988,8 @@
codegen_->Load64BitValue(output, kPrimLongMax);
// if input >= (double)LONG_MAX goto done
- __ comisd(input, codegen_->LiteralDoubleAddress(kPrimLongMax));
+ __ comisd(input, codegen_->LiteralDoubleAddress(
+ static_cast<double>(kPrimLongMax)));
__ j(kAboveEqual, &done);
// if input == NaN goto nan
__ j(kUnordered, &nan);