summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2018-07-14 20:24:49 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-07-14 20:24:49 +0000
commite24c69db699cf92b9ee4182442be3066ce1be762 (patch)
tree4edc7e4811cc570cf29ac0ec47b04cfd2b5383f1 /compiler/optimizing
parentcdfc942e60032622b5a4379d0dd5ca914ba6393a (diff)
parent9434487f640d4a4c247e916e30137b9359f50eed (diff)
Merge "Expand comment for HVecMultiplyAccumulate"
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/nodes_vector.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes_vector.h b/compiler/optimizing/nodes_vector.h
index c5e9a8d036..95fb5ab76a 100644
--- a/compiler/optimizing/nodes_vector.h
+++ b/compiler/optimizing/nodes_vector.h
@@ -931,6 +931,9 @@ class HVecSetScalars FINAL : public HVecOperation {
// Multiplies every component in the two vectors, adds the result vector to the accumulator vector,
// viz. [ a1, .. , an ] + [ x1, .. , xn ] * [ y1, .. , yn ] = [ a1 + x1 * y1, .. , an + xn * yn ].
+// For floating point types, Java rounding behavior must be preserved; the products are rounded to
+// the proper precision before being added. "Fused" multiply-add operations available on several
+// architectures are not usable since they would violate Java language rules.
class HVecMultiplyAccumulate FINAL : public HVecOperation {
public:
HVecMultiplyAccumulate(ArenaAllocator* allocator,
@@ -953,6 +956,9 @@ class HVecMultiplyAccumulate FINAL : public HVecOperation {
DCHECK(HasConsistentPackedTypes(accumulator, packed_type));
DCHECK(HasConsistentPackedTypes(mul_left, packed_type));
DCHECK(HasConsistentPackedTypes(mul_right, packed_type));
+ // Remove the following if we add an architecture that supports floating point multiply-add
+ // with Java-compatible rounding.
+ DCHECK(DataType::IsIntegralType(packed_type));
SetRawInputAt(0, accumulator);
SetRawInputAt(1, mul_left);
SetRawInputAt(2, mul_right);