diff options
author | Andrew Pinski <pinskia@gmail.com> | 2023-11-13 20:18:34 +0000 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2023-11-17 07:45:33 +0800 |
commit | 9e9279fadbd1c673c875b9d20261d2de0473f63f (patch) | |
tree | 8522ab7692eff49ca3544c4fc36a102f2c6ccac3 /gcc | |
parent | 1c1ee8097c3d96c74107a317f68b0ad40cf9207b (diff) | |
download | gcc-9e9279fadbd1c673c875b9d20261d2de0473f63f.zip gcc-9e9279fadbd1c673c875b9d20261d2de0473f63f.tar.gz gcc-9e9279fadbd1c673c875b9d20261d2de0473f63f.tar.bz2 |
Only allow (copysign x, NEG_CONST) -> (fneg (fabs x)) simplification for constant folding [PR112483]
On targets with native copysign instructions, (copysign x, -1) is
usually more efficient than (fneg (fabs x)). Since r14-5284, in the
middle end we always optimize (fneg (fabs x)) to (copysign x, -1), not
vice versa. If the target does not support native fcopysign,
expand_COPYSIGN will expand it as (fneg (fabs x)) anyway.
gcc/ChangeLog:
PR rtl-optimization/112483
* simplify-rtx.cc (simplify_binary_operation_1) <case COPYSIGN>:
Call simplify_unary_operation for NEG instead of
simplify_gen_unary.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/simplify-rtx.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index 2d2e5a3..f3745d8 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, tmp, mode); + tmp = simplify_unary_operation (NEG, mode, tmp, mode); return tmp; } if (GET_CODE (op0) == NEG || GET_CODE (op0) == ABS) |