[gcc/devel/gccgo] middle-end: Improve RTL expansion in expand_mul_overflow,
Ian Lance Taylor
ian@gcc.gnu.org
Sun Jul 12 20:36:01 GMT 2020
https://gcc.gnu.org/g:2b4bbc17077ac12fc9742ade4919a6de0277ac8c
commit 2b4bbc17077ac12fc9742ade4919a6de0277ac8c
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Sat Jul 11 20:03:39 2020 +0100
middle-end: Improve RTL expansion in expand_mul_overflow,
This patch improves the RTL that the middle-end generates for testing
signed overflow following a widening multiplication. During this
expansion the middle-end generates a truncation which can get used
multiple times. Placing this intermediate value in a pseudo register
reduces the amount of code generated on platforms where this truncation
requires an explicit instruction.
2020-07-11 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog:
* internal-fn.c (expand_mul_overflow): When checking for signed
overflow from a widening multiplication, we access the truncated
lowpart RES twice, so keep this value in a pseudo register.
Diff:
---
gcc/internal-fn.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index a15031f794d..8efc77d986b 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -1629,6 +1629,9 @@ expand_mul_overflow (location_t loc, tree lhs, tree arg0, tree arg1,
profile_probability::very_likely ());
else
{
+ /* RES is used more than once, place it in a pseudo. */
+ res = force_reg (mode, res);
+
rtx signbit = expand_shift (RSHIFT_EXPR, mode, res, prec - 1,
NULL_RTX, 0);
/* RES is low half of the double width result, HIPART
More information about the Gcc-cvs
mailing list