public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/16800] New: PowerPC - Unnecessary rldicl
@ 2004-07-28 17:01 gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:39 ` [Bug target/16800] " bangerth at dealii dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-07-28 17:01 UTC (permalink / raw)
To: gcc-bugs
Description:
A non-optimal code sequence is illustrated. The rldicl noted below is not needed (and doesn't occur for the "==" comparison). Duplicate using gcc 3.5 and command line:
gcc -O3 -m64 -c test.c
Testcase:
long l1,l2;
float f1,f2,f3,f4;
void logic_func4() {
l1 = (f1 == f2);
l2 = (f3 > f4);
}
Assembly:
.logic_func4:
ld 8,.LC5@toc(2)
ld 6,.LC4@toc(2)
lfs 13,0(8)
lfs 11,0(6)
ld 5,.LC1@toc(2)
ld 4,.LC2@toc(2)
lfs 12,0(5)
fcmpu 7,11,13
lfs 0,0(4)
ld 11,.LC0@toc(2)
ld 10,.LC3@toc(2)
fcmpu 6,12,0
mfcr 3
rlwinm 3,3,30,1
rldicl 0,3,0,32 <-- Unnecessary.
mfcr 9
rlwinm 9,9,27,1
std 0,0(10)
std 9,0(11)
blr
--
Summary: PowerPC - Unnecessary rldicl
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P1
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steinmtz at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
dot com
GCC build triplet: powerpc64-linux
GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/16800] PowerPC - Unnecessary rldicl
2004-07-28 17:01 [Bug other/16800] New: PowerPC - Unnecessary rldicl gcc-bugzilla at gcc dot gnu dot org
@ 2004-07-28 17:39 ` bangerth at dealii dot org
2004-08-02 1:02 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2004-07-28 17:39 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|other |target
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/16800] PowerPC - Unnecessary rldicl
2004-07-28 17:01 [Bug other/16800] New: PowerPC - Unnecessary rldicl gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:39 ` [Bug target/16800] " bangerth at dealii dot org
@ 2004-08-02 1:02 ` pinskia at gcc dot gnu dot org
2004-11-01 0:27 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-02 1:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-02 01:02 -------
Confirmed, I think this is a target problem:
(insn:TI 36 20 37 0 (set (reg:SI 0 0 [134])
(gt:SI (reg:CCFP 75 7 [135])
(const_int 0 [0x0]))) 422 {*rs6000.md:11384} (insn_list 34 (nil))
(expr_list:REG_DEAD (reg:CCFP 75 7 [135])
(nil)))
(insn:TI 37 36 23 0 (set (reg:DI 0 0 [131])
(zero_extend:DI (reg:SI 0 0 [134]))) 12 {*rs6000.md:374} (insn_list 36 (nil))
(expr_list:REG_EQUIV (mem/i:DI (reg/f:DI 10 10 [128]) [4 l2+0 S8 A64])
(nil)))
(insn:TI 23 37 38 0 (set (reg:DI 9 9 [122])
(eq:DI (reg:CCFP 74 6 [126])
(const_int 0 [0x0]))) 423 {*rs6000.md:11416} (insn_list:REG_DEP_ANTI 32
(insn_list:REG_DEP_OUTPUT 29 (insn_list 20
(nil))))
(expr_list:REG_DEAD (reg:CCFP 74 6 [126])
(expr_list:REG_EQUIV (mem/i:DI (reg/f:DI 11 11 [119]) [4 l1+0 S8 A64])
(nil))))
But I could be wrong.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2004-08-02 01:02:22
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/16800] PowerPC - Unnecessary rldicl
2004-07-28 17:01 [Bug other/16800] New: PowerPC - Unnecessary rldicl gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:39 ` [Bug target/16800] " bangerth at dealii dot org
2004-08-02 1:02 ` pinskia at gcc dot gnu dot org
@ 2004-11-01 0:27 ` pinskia at gcc dot gnu dot org
2004-11-22 22:28 ` steinmtz at us dot ibm dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-01 0:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-01 00:27 -------
Fixed on the mainline.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/16800] PowerPC - Unnecessary rldicl
2004-07-28 17:01 [Bug other/16800] New: PowerPC - Unnecessary rldicl gcc-bugzilla at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-11-01 0:27 ` pinskia at gcc dot gnu dot org
@ 2004-11-22 22:28 ` steinmtz at us dot ibm dot com
2004-11-24 7:00 ` amodra at bigpond dot net dot au
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: steinmtz at us dot ibm dot com @ 2004-11-22 22:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steinmtz at us dot ibm dot com 2004-11-22 22:27 -------
I rechecked this one with a version of mainline built today (11/22/04) and the
problem still appears.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/16800] PowerPC - Unnecessary rldicl
2004-07-28 17:01 [Bug other/16800] New: PowerPC - Unnecessary rldicl gcc-bugzilla at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-11-22 22:28 ` steinmtz at us dot ibm dot com
@ 2004-11-24 7:00 ` amodra at bigpond dot net dot au
2004-11-24 9:41 ` amodra at bigpond dot net dot au
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-11-24 7:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amodra at bigpond dot net dot au 2004-11-24 07:00 -------
I believe this problem is caused by rs6000_rtx_costs. The two following insns
are successfully combined:
(insn 20 19 21 0 (set (reg:DI 126)
(eq:DI (reg:CCFP 125)
(const_int 0 [0x0]))) 410 {*rs6000.md:11408} (insn_list:REG_DEP_TRUE
19 (nil))
(expr_list:REG_DEAD (reg:CCFP 125)
(nil)))
(insn 21 20 22 0 (set (reg:SI 124)
(subreg:SI (reg:DI 126) 4)) 280 {*movsi_internal1}
(insn_list:REG_DEP_TRUE 20 (nil))
(expr_list:REG_DEAD (reg:DI 126)
(nil)))
to
(insn 21 20 22 0 (set (reg:SI 124)
(eq:SI (reg:CCFP 125)
(const_int 0 [0x0]))) 409 {*rs6000.md:11376} (insn_list:REG_DEP_TRUE
20 (nil))
(expr_list:REG_DEAD (reg:DI 126)
(nil)))
Following that, the new insn 21 and
(insn 22 21 23 0 (set (reg:DI 121)
(zero_extend:DI (reg:SI 124))) 24 {*rs6000.md:379}
(insn_list:REG_DEP_TRUE 21 (nil))
(expr_list:REG_DEAD (reg:SI 124)
(nil)))
is a combine candidate, with a good result pattern of
(set (reg:DI 121)
(eq:DI (reg:CCFP 125)
(const_int 0 [0x0])))
However, rs6000_rtx_costs decides this patten is more expensive than the
previous two instructions.
rejecting combination of insns 21 and 22
original costs 12 + 4 = 16
replacement cost 20
Code in question is as follows. I don't understand why these particular
comparisons have been singled out, or why the mode == Pmode test.
This contributes 12
case EQ:
case GTU:
case LTU:
if (mode == Pmode)
{
switch (outer_code)
{
case SET:
*total = COSTS_N_INSNS (3);
break;
The (const_int 0) contributes 8! This is because outer_code is EQ, which
doesn't match anything in the rather long set of outer_code tests for CONST_INT.
An obvious fix is to handle EQ and other comparisons here.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |dje at gcc dot gnu dot org
Last reconfirmed|2004-08-02 01:02:22 |2004-11-24 07:00:16
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/16800] PowerPC - Unnecessary rldicl
2004-07-28 17:01 [Bug other/16800] New: PowerPC - Unnecessary rldicl gcc-bugzilla at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-11-24 7:00 ` amodra at bigpond dot net dot au
@ 2004-11-24 9:41 ` amodra at bigpond dot net dot au
2004-11-24 15:22 ` dje at watson dot ibm dot com
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-11-24 9:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amodra at bigpond dot net dot au 2004-11-24 09:40 -------
Of course, fixing the odd rtx_cost for the (const_int 0) inside an EQ doesn't
help this particular bug. More or less the same happens:
rejecting combination of insns 21 and 22
original costs 4 + 4 = 8
replacement cost 12
It's the 12 counted for EQ that's the problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/16800] PowerPC - Unnecessary rldicl
2004-07-28 17:01 [Bug other/16800] New: PowerPC - Unnecessary rldicl gcc-bugzilla at gcc dot gnu dot org
` (5 preceding siblings ...)
2004-11-24 9:41 ` amodra at bigpond dot net dot au
@ 2004-11-24 15:22 ` dje at watson dot ibm dot com
2004-11-27 23:01 ` cvs-commit at gcc dot gnu dot org
2004-11-28 0:07 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: dje at watson dot ibm dot com @ 2004-11-24 15:22 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dje at watson dot ibm dot com 2004-11-24 15:21 -------
Subject: Re: PowerPC - Unnecessary rldicl
The test for mode == Pmode is present because most of the fast scc
patterns depend on carry. PowerPC carry depends on the mode of the
processor. If the mode of the comparison is not the mode of the processor
(Pmode), the scc patterns cannot be applied and the modified cost should
not be applied.
Similarly, only EQ, GTU, and LTU costs are handled because those
are the fast scc patterns active for PowerPC. I did not include the costs
for the original POWER architecture.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/16800] PowerPC - Unnecessary rldicl
2004-07-28 17:01 [Bug other/16800] New: PowerPC - Unnecessary rldicl gcc-bugzilla at gcc dot gnu dot org
` (6 preceding siblings ...)
2004-11-24 15:22 ` dje at watson dot ibm dot com
@ 2004-11-27 23:01 ` cvs-commit at gcc dot gnu dot org
2004-11-28 0:07 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-27 23:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-11-27 23:01 -------
Subject: Bug 16800
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: dje@gcc.gnu.org 2004-11-27 23:01:00
Modified files:
gcc : ChangeLog
gcc/config/rs6000: rs6000.c
Log message:
PR target/16800
* config/rs6000/rs6000.c (rs6000_rtx_costs): Improve accuracy of
EQ, GTU, and LTU costs. Add costs for GT, LT, and UNORDERED.
Distinguish between SImode and DImode CONST_INT.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6593&r2=2.6594
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&r1=1.756&r2=1.757
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/16800] PowerPC - Unnecessary rldicl
2004-07-28 17:01 [Bug other/16800] New: PowerPC - Unnecessary rldicl gcc-bugzilla at gcc dot gnu dot org
` (7 preceding siblings ...)
2004-11-27 23:01 ` cvs-commit at gcc dot gnu dot org
@ 2004-11-28 0:07 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-28 0:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-28 00:07 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16800
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-11-28 0:07 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-28 17:01 [Bug other/16800] New: PowerPC - Unnecessary rldicl gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:39 ` [Bug target/16800] " bangerth at dealii dot org
2004-08-02 1:02 ` pinskia at gcc dot gnu dot org
2004-11-01 0:27 ` pinskia at gcc dot gnu dot org
2004-11-22 22:28 ` steinmtz at us dot ibm dot com
2004-11-24 7:00 ` amodra at bigpond dot net dot au
2004-11-24 9:41 ` amodra at bigpond dot net dot au
2004-11-24 15:22 ` dje at watson dot ibm dot com
2004-11-27 23:01 ` cvs-commit at gcc dot gnu dot org
2004-11-28 0:07 ` 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).