This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/84756] Multiplication done twice just to get upper and lower parts of product
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Mar 2018 08:51:28 +0000
- Subject: [Bug target/84756] Multiplication done twice just to get upper and lower parts of product
- Auto-submitted: auto-generated
- References: <bug-84756-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84756
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
We immediately narrow "return (Longer)a*b;" to "return a*b;" which makes it
hard to CSE later.
If you can, it would be better to write the code as:
Longer mul = (Longer)a*b;
... use mul twice ...
Not sure what the best place would be for this optimization. Somewhere in RTL
when we don't care about signed/unsigned? Earlier in value numbering, checking
for each mult if a widening version is already available? Other, say like we
check if cos and sin are called on the same argument?