Merge changes I00dc6cfc,Iae8f1c88
* changes:
ART: Disable Math.round intrinsics
Revert "Make Math.round consistent on arm64."
diff --git a/compiler/dex/quick/arm64/fp_arm64.cc b/compiler/dex/quick/arm64/fp_arm64.cc
index 97f13e9..0130ef4 100644
--- a/compiler/dex/quick/arm64/fp_arm64.cc
+++ b/compiler/dex/quick/arm64/fp_arm64.cc
@@ -448,8 +448,8 @@
}
bool Arm64Mir2Lir::GenInlinedRound(CallInfo* info, bool is_double) {
+ // b/26327751.
if ((true)) {
- // TODO(26327751): Re-enable?
return false;
}
int32_t encoded_imm = EncodeImmSingle(bit_cast<uint32_t, float>(0.5f));
diff --git a/compiler/optimizing/intrinsics.h b/compiler/optimizing/intrinsics.h
index e459516..a6db1e8 100644
--- a/compiler/optimizing/intrinsics.h
+++ b/compiler/optimizing/intrinsics.h
@@ -27,6 +27,9 @@
class CompilerDriver;
class DexFile;
+// Temporary measure until we have caught up with the Java 7 definition of Math.round. b/26327751
+static constexpr bool kRoundIsPlusPointFive = false;
+
// Recognize intrinsics from HInvoke nodes.
class IntrinsicsRecognizer : public HOptimization {
public:
diff --git a/compiler/optimizing/intrinsics_arm64.cc b/compiler/optimizing/intrinsics_arm64.cc
index 4e7f60d..f723940 100644
--- a/compiler/optimizing/intrinsics_arm64.cc
+++ b/compiler/optimizing/intrinsics_arm64.cc
@@ -614,11 +614,10 @@
}
void IntrinsicLocationsBuilderARM64::VisitMathRoundDouble(HInvoke* invoke) {
- if ((true)) {
- // TODO(26327751): Re-enable?
- return;
+ // See intrinsics.h.
+ if (kRoundIsPlusPointFive) {
+ CreateFPToIntPlusTempLocations(arena_, invoke);
}
- CreateFPToIntPlusTempLocations(arena_, invoke);
}
void IntrinsicCodeGeneratorARM64::VisitMathRoundDouble(HInvoke* invoke) {
@@ -626,11 +625,10 @@
}
void IntrinsicLocationsBuilderARM64::VisitMathRoundFloat(HInvoke* invoke) {
- if ((true)) {
- // TODO(26327751): Re-enable?
- return;
+ // See intrinsics.h.
+ if (kRoundIsPlusPointFive) {
+ CreateFPToIntPlusTempLocations(arena_, invoke);
}
- CreateFPToIntPlusTempLocations(arena_, invoke);
}
void IntrinsicCodeGeneratorARM64::VisitMathRoundFloat(HInvoke* invoke) {
diff --git a/compiler/optimizing/intrinsics_x86.cc b/compiler/optimizing/intrinsics_x86.cc
index 8019062..677f2e9 100644
--- a/compiler/optimizing/intrinsics_x86.cc
+++ b/compiler/optimizing/intrinsics_x86.cc
@@ -720,6 +720,11 @@
// Note that 32 bit x86 doesn't have the capability to inline MathRoundDouble,
// as it needs 64 bit instructions.
void IntrinsicLocationsBuilderX86::VisitMathRoundFloat(HInvoke* invoke) {
+ // See intrinsics.h.
+ if (!kRoundIsPlusPointFive) {
+ return;
+ }
+
// Do we have instruction support?
if (codegen_->GetInstructionSetFeatures().HasSSE4_1()) {
LocationSummary* locations = new (arena_) LocationSummary(invoke,
diff --git a/compiler/optimizing/intrinsics_x86_64.cc b/compiler/optimizing/intrinsics_x86_64.cc
index aa1c109..690cf3d 100644
--- a/compiler/optimizing/intrinsics_x86_64.cc
+++ b/compiler/optimizing/intrinsics_x86_64.cc
@@ -610,7 +610,10 @@
}
void IntrinsicLocationsBuilderX86_64::VisitMathRoundFloat(HInvoke* invoke) {
- CreateSSE41FPToIntLocations(arena_, invoke, codegen_);
+ // See intrinsics.h.
+ if (kRoundIsPlusPointFive) {
+ CreateSSE41FPToIntLocations(arena_, invoke, codegen_);
+ }
}
void IntrinsicCodeGeneratorX86_64::VisitMathRoundFloat(HInvoke* invoke) {
@@ -657,7 +660,10 @@
}
void IntrinsicLocationsBuilderX86_64::VisitMathRoundDouble(HInvoke* invoke) {
- CreateSSE41FPToIntLocations(arena_, invoke, codegen_);
+ // See intrinsics.h.
+ if (kRoundIsPlusPointFive) {
+ CreateSSE41FPToIntLocations(arena_, invoke, codegen_);
+ }
}
void IntrinsicCodeGeneratorX86_64::VisitMathRoundDouble(HInvoke* invoke) {