diff options
author | 2018-07-13 09:57:50 -0700 | |
---|---|---|
committer | 2018-07-13 13:10:40 -0700 | |
commit | 9434487f640d4a4c247e916e30137b9359f50eed (patch) | |
tree | 4edc7e4811cc570cf29ac0ec47b04cfd2b5383f1 /compiler/optimizing/nodes_vector.h | |
parent | cdfc942e60032622b5a4379d0dd5ca914ba6393a (diff) |
Expand comment for HVecMultiplyAccumulate
State explicitly that fused multiply-add may not be used, since this
was a source of prior confusion. Add a DCHECK to draw developers
attention to this, if they try to add a floating point multiply-add.
See https://android-review.googlesource.com/c/platform/art/+/716505 .
Test: Treehugger
Change-Id: I1331be120a0a54baeb4da92e9211407b08892e98
Diffstat (limited to 'compiler/optimizing/nodes_vector.h')
-rw-r--r-- | compiler/optimizing/nodes_vector.h | 6 |
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); |