diff options
author | Roger Sayle <roger@eyesopen.com> | 2003-06-04 04:42:14 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2003-06-04 04:42:14 +0000 |
commit | df8ca70ebb0554370fe70e627a59587b15a07711 (patch) | |
tree | 9e569f6e49a6419e0b3351ab9425b3c72b0534b0 | |
parent | 894207cf0ac9f0a841565779d78777cee2464e55 (diff) | |
download | gcc-df8ca70ebb0554370fe70e627a59587b15a07711.zip gcc-df8ca70ebb0554370fe70e627a59587b15a07711.tar.gz gcc-df8ca70ebb0554370fe70e627a59587b15a07711.tar.bz2 |
optabs.c (expand_binop): Optimize complex multiplication for the case of squaring a complex argument.
* optabs.c (expand_binop): Optimize complex multiplication for
the case of squaring a complex argument.
From-SVN: r67418
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/optabs.c | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 034d6cc..82c26bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2003-06-03 Roger Sayle <roger@eyesopen.com> + * optabs.c (expand_binop): Optimize complex multiplication for + the case of squaring a complex argument. + +2003-06-03 Roger Sayle <roger@eyesopen.com> + * optabs.c (expand_binop): Attempt to reuse pseudos for duplicate non-volatile operands of binary operations. (prepare_cmp_insn): Likewise. diff --git a/gcc/optabs.c b/gcc/optabs.c index 171d13f..c693e80 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -1647,8 +1647,13 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) temp1 = expand_binop (submode, binoptab, real0, imag1, NULL_RTX, unsignedp, methods); - temp2 = expand_binop (submode, binoptab, real1, imag0, - NULL_RTX, unsignedp, methods); + /* Avoid expanding redundant multiplication for the common + case of squaring a complex number. */ + if (rtx_equal_p (real0, real1) && rtx_equal_p (imag0, imag1)) + temp2 = temp1; + else + temp2 = expand_binop (submode, binoptab, real1, imag0, + NULL_RTX, unsignedp, methods); if (temp1 == 0 || temp2 == 0) break; |