public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/65214] New: [SH] Optimize sign/zero extensions across basic blocks
@ 2015-02-25 22:27 olegendo at gcc dot gnu.org
2024-03-28 5:09 ` [Bug target/65214] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-25 22:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65214
Bug ID: 65214
Summary: [SH] Optimize sign/zero extensions across basic blocks
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: olegendo at gcc dot gnu.org
Target: sh*-*-*
This is an example from gcc.c-torture/execute/pr20187-1.c:
int a = 0x101;
int b = 0x100;
int
test (void)
{
return (((unsigned char) (unsigned long long) ((a ? a : 1) & (a * b)))
? 0 : 1);
}
compiled with -m4 -ml -O2 -fdisable-rtl-dbr:
mov.l .L6,r1
mov.l @r1,r2
mov #1,r1 // r1 is zero extended after constant load
tst r2,r2
bt .L2
exts.b r2,r1
.L2:
mov.l .L7,r3
extu.b r1,r1 // r1 = extu.b (exts.b (r2))
mov.l @r3,r3
mulu.w r2,r3
sts macl,r3
tst r3,r1
movt r0
rts
nop
The extu.b basically overrides result of exts.b. Thus we can replace the
exts.b with extu.b and eliminate one insn:
mov.l .L6,r1
mov.l @r1,r2
mov #1,r1
tst r2,r2
bt .L2
extu.b r2,r1
.L2:
mov.l .L7,r3
mov.l @r3,r3
mulu.w r2,r3
sts macl,r3
tst r3,r1
movt r0
rts
nop
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/65214] [SH] Optimize sign/zero extensions across basic blocks
2015-02-25 22:27 [Bug target/65214] New: [SH] Optimize sign/zero extensions across basic blocks olegendo at gcc dot gnu.org
@ 2024-03-28 5:09 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-28 5:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65214
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-28 5:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 22:27 [Bug target/65214] New: [SH] Optimize sign/zero extensions across basic blocks olegendo at gcc dot gnu.org
2024-03-28 5:09 ` [Bug target/65214] " pinskia at gcc dot gnu.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).