aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2023-11-12 14:16:20 +0000
committerXi Ruoyao <xry111@xry111.site>2023-11-13 15:51:14 +0800
commit7ba7529ee3974667a8e68d089b606ac2fb159415 (patch)
tree82ed38a31d4eb8af5ae281c84438531963289771
parent5a0c302d2d721b9650c1e354695dbba87364c334 (diff)
downloadgcc-7ba7529ee3974667a8e68d089b606ac2fb159415.zip
gcc-7ba7529ee3974667a8e68d089b606ac2fb159415.tar.gz
gcc-7ba7529ee3974667a8e68d089b606ac2fb159415.tar.bz2
Fix (fcopysign x, NEGATIVE_CONST) -> (fneg (fabs x)) simplification [PR112483]
(fcopysign x, NEGATIVE_CONST) can be simplified to (fneg (fabs x)), but a logic error in the code caused it mistakenly simplified to (fneg x) instead. gcc/ChangeLog: PR rtl-optimization/112483 * simplify-rtx.cc (simplify_binary_operation_1) <case COPYSIGN>: Fix the simplification of (fcopysign x, NEGATIVE_CONST).
-rw-r--r--gcc/simplify-rtx.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
index 69d8757..2d2e5a3 100644
--- a/gcc/simplify-rtx.cc
+++ b/gcc/simplify-rtx.cc
@@ -4392,7 +4392,7 @@ simplify_ashift:
real_convert (&f1, mode, CONST_DOUBLE_REAL_VALUE (trueop1));
rtx tmp = simplify_gen_unary (ABS, mode, op0, mode);
if (REAL_VALUE_NEGATIVE (f1))
- tmp = simplify_gen_unary (NEG, mode, op0, mode);
+ tmp = simplify_gen_unary (NEG, mode, tmp, mode);
return tmp;
}
if (GET_CODE (op0) == NEG || GET_CODE (op0) == ABS)