public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/22067] New: Inconsistent multiply by immediate
@ 2005-06-14 21:19 pthaugen at us dot ibm dot com
2005-06-14 21:23 ` [Bug middle-end/22067] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: pthaugen at us dot ibm dot com @ 2005-06-14 21:19 UTC (permalink / raw)
To: gcc-bugs
PR17103 states that mulli is better than decomposing into shift/add sequence.
Following is example where we are being inconsistent about that decision.
Compiled with gcc -O2 -mcpu=power4 -m32
struct S {
int i1,i2,i3,i4,i5,i6;
}s[10];
int y;
int test1(int j, int x)
{
y = y * 24; // shift/sub
s[j].i1 = 1; // mulli
return (x * 24); // mulli
}
--
Summary: Inconsistent multiply by immediate
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pthaugen at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc64-linux
GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22067
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/22067] Inconsistent multiply by immediate
2005-06-14 21:19 [Bug other/22067] New: Inconsistent multiply by immediate pthaugen at us dot ibm dot com
@ 2005-06-14 21:23 ` pinskia at gcc dot gnu dot org
2005-09-17 3:49 ` dje at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-14 21:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-14 21:23 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|other |middle-end
Ever Confirmed| |1
GCC build triplet|powerpc64-linux |
GCC host triplet|powerpc64-linux |
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2005-06-14 21:23:27
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22067
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/22067] Inconsistent multiply by immediate
2005-06-14 21:19 [Bug other/22067] New: Inconsistent multiply by immediate pthaugen at us dot ibm dot com
2005-06-14 21:23 ` [Bug middle-end/22067] " pinskia at gcc dot gnu dot org
@ 2005-09-17 3:49 ` dje at gcc dot gnu dot org
2005-09-17 4:28 ` dje at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-09-17 3:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dje at gcc dot gnu dot org 2005-09-17 03:49 -------
The mult_cost argument to choose_mult_variant() and the cost of the best
shift/add sequence are not always representing the same operation, so the
comparison is not always correct. The synth_mult cost is just the cost of the
multiplication by a constant, but the mult_cost argument includes the full
rtx_cost of the insn, including address cost. For example
(mult:SI (mem/c/i:SI (reg/f:SI 123) [5 y+0 S4 A32])
(const_int 24 [0x18]))
rtx_cost will include the cost of the MEM. This artificially inflates the cost
of the MULT, making the shift/add sequence seem more efficient.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22067
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/22067] Inconsistent multiply by immediate
2005-06-14 21:19 [Bug other/22067] New: Inconsistent multiply by immediate pthaugen at us dot ibm dot com
2005-06-14 21:23 ` [Bug middle-end/22067] " pinskia at gcc dot gnu dot org
2005-09-17 3:49 ` dje at gcc dot gnu dot org
@ 2005-09-17 4:28 ` dje at gcc dot gnu dot org
2005-09-17 20:18 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-09-17 4:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dje at gcc dot gnu dot org 2005-09-17 04:28 -------
I think the patch in attachment 9747 that subtracts the cost of operand0 is the
correct solution. One generally does want the cost of the operands included, so
rtx_costs is correct. choose_mult_variant would consider too long a sequence if
it *added* the cost of operand0, so the correct solution appears to be
subtracting the cost.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |dje at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22067
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/22067] Inconsistent multiply by immediate
2005-06-14 21:19 [Bug other/22067] New: Inconsistent multiply by immediate pthaugen at us dot ibm dot com
` (2 preceding siblings ...)
2005-09-17 4:28 ` dje at gcc dot gnu dot org
@ 2005-09-17 20:18 ` cvs-commit at gcc dot gnu dot org
2005-09-17 20:20 ` dje at gcc dot gnu dot org
2005-09-17 21:08 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-17 20:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-17 20:18 -------
Subject: Bug 22067
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: dje@gcc.gnu.org 2005-09-17 20:17:55
Modified files:
gcc : ChangeLog expmed.c
Log message:
PR middle-end/22067
* expmed.c (expand_mult): Substitute simple register for op0 when
computing max_cost.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9968&r2=2.9969
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expmed.c.diff?cvsroot=gcc&r1=1.232&r2=1.233
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22067
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/22067] Inconsistent multiply by immediate
2005-06-14 21:19 [Bug other/22067] New: Inconsistent multiply by immediate pthaugen at us dot ibm dot com
` (3 preceding siblings ...)
2005-09-17 20:18 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-17 20:20 ` dje at gcc dot gnu dot org
2005-09-17 21:08 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-09-17 20:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dje at gcc dot gnu dot org 2005-09-17 20:20 -------
Patch committed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22067
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/22067] Inconsistent multiply by immediate
2005-06-14 21:19 [Bug other/22067] New: Inconsistent multiply by immediate pthaugen at us dot ibm dot com
` (4 preceding siblings ...)
2005-09-17 20:20 ` dje at gcc dot gnu dot org
@ 2005-09-17 21:08 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-17 21:08 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22067
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-09-17 21:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-14 21:19 [Bug other/22067] New: Inconsistent multiply by immediate pthaugen at us dot ibm dot com
2005-06-14 21:23 ` [Bug middle-end/22067] " pinskia at gcc dot gnu dot org
2005-09-17 3:49 ` dje at gcc dot gnu dot org
2005-09-17 4:28 ` dje at gcc dot gnu dot org
2005-09-17 20:18 ` cvs-commit at gcc dot gnu dot org
2005-09-17 20:20 ` dje at gcc dot gnu dot org
2005-09-17 21:08 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).