public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction.
@ 2004-07-28 17:01 gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:36 ` [Bug target/16798] " bangerth at dealii dot org
` (3 more replies)
0 siblings, 4 replies; 5+ 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 illustraded. The recording form of an instruction could be used allowing for the elimination of a compare. Duplicate using gcc 3.5 and command line:
gcc -O3 -m64 -c test.c
Testcase:
long int i, j;
int foo ()
{
j = (i>>52);
if (j< 0) {
i = 10;
} else {
i = 20;
};
return i;
}
Assembly:
.foo:
ld 11,.LC0@toc(2)
ld 9,.LC1@toc(2)
ld 0,0(11)
sradi 0,0,52 <-- Use the recording form of sradi
cmpdi 7,0,0 <-- and eliminate this compare.
std 0,0(9)
blt- 7,.L7
li 0,20
std 0,0(11)
lwa 3,4(11)
blr
.L7:
li 0,10
std 0,0(11)
lwa 3,4(11)
blr
--
Summary: PowerPC - Opportunity to use recording form instruction.
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=16798
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
2004-07-28 17:01 [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction gcc-bugzilla at gcc dot gnu dot org
@ 2004-07-28 17:36 ` bangerth at dealii dot org
2004-08-01 0:54 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2004-07-28 17:36 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|other |target
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
2004-07-28 17:01 [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:36 ` [Bug target/16798] " bangerth at dealii dot org
@ 2004-08-01 0:54 ` pinskia at gcc dot gnu dot org
2004-10-31 4:58 ` pinskia at gcc dot gnu dot org
2004-11-09 12:26 ` nathan at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-01 0:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-01 00:54 -------
Note IIRC this is really only a size win rather than a performance win but I could be wrong.
Confirmed but I cannot understand why not:
(define_insn "*ashrdi3_internal1"
[(set (match_operand:DI 0 "gpc_reg_operand" "=r")
(ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
(match_operand:SI 2 "reg_or_cint_operand" "ri")))]
"TARGET_POWERPC64"
"srad%I2 %0,%1,%H2")
....
(define_insn "*ashrdi3_internal3"
[(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
(compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
(match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
(const_int 0)))
(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
(ashiftrt:DI (match_dup 1) (match_dup 2)))]
"TARGET_64BIT"
"@
srad%I2. %0,%1,%H2
#"
[(set_attr "type" "delayed_compare")
(set_attr "length" "4,8")])
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-08-01 00:54:58
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
2004-07-28 17:01 [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:36 ` [Bug target/16798] " bangerth at dealii dot org
2004-08-01 0:54 ` pinskia at gcc dot gnu dot org
@ 2004-10-31 4:58 ` pinskia at gcc dot gnu dot org
2004-11-09 12:26 ` nathan at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-31 4:58 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Last reconfirmed|2004-08-01 00:54:58 |2004-10-31 04:58:03
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
2004-07-28 17:01 [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction gcc-bugzilla at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-10-31 4:58 ` pinskia at gcc dot gnu dot org
@ 2004-11-09 12:26 ` nathan at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-11-09 12:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From nathan at gcc dot gnu dot org 2004-11-09 12:25 -------
The problem here is that combine only combines chains of instructions that have
no other uses of the intermediate results. In this case, the intermediate
result is stored into a global variable.
One solution would be to add a peephole, but that would only trigger when (a)
the shift and compare were adjacent, and (b) the compare used CR0. You'd also
need peepholers for all the instructions that can implicitly set CR0.
Really combine, which is a generic peepholer, needs some kind of templatizing on
the target machine. It currently functions by generating promising patterns and
then seeing if they exist. This is wasteful, in that it generates many
patterns that don't exist on the particular target, and it is blind in that it
doesn't spot any special cases the target might have (like this case). What's
needed is something like pre-reg-alloc peepholes. That of course would be a
large amount of work.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-11-09 12:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-28 17:01 [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:36 ` [Bug target/16798] " bangerth at dealii dot org
2004-08-01 0:54 ` pinskia at gcc dot gnu dot org
2004-10-31 4:58 ` pinskia at gcc dot gnu dot org
2004-11-09 12:26 ` nathan 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).