public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register
[not found] <bug-9760-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-26 7:29 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-26 7:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=9760
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Still happens on the trunk.
Note armv7-a produces reasonable code though as it uses ubfx which is new for
armv7-a:
push {r4, lr}
mov r4, r0
movs r0, #8
lsrs r1, r4, #24
bl func
ubfx r1, r4, #16, #8
movs r0, #8
bl func
ubfx r1, r4, #8, #8
movs r0, #8
pop {r4, lr}
b func
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register
[not found] <bug-9760-5458@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2010-02-08 16:30 ` rearnsha at arm dot com
@ 2010-02-08 16:31 ` rearnsha at arm dot com
3 siblings, 0 replies; 10+ messages in thread
From: rearnsha at arm dot com @ 2010-02-08 16:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from rearnsha at arm dot com 2010-02-08 16:31 -------
Subject: Re: [arm] Combine cannot do its job because
immediate operand is used instead of register
On Mon, 2010-02-08 at 16:30 +0000, rearnsha at arm dot com wrote:
> mov r1, r5, r4, lsr #8
>
Should, of course, be AND.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9760
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register
[not found] <bug-9760-5458@http.gcc.gnu.org/bugzilla/>
2009-03-12 18:45 ` ramana dot r at gmail dot com
2010-02-08 16:11 ` steven at gcc dot gnu dot org
@ 2010-02-08 16:30 ` rearnsha at arm dot com
2010-02-08 16:31 ` rearnsha at arm dot com
3 siblings, 0 replies; 10+ messages in thread
From: rearnsha at arm dot com @ 2010-02-08 16:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from rearnsha at arm dot com 2010-02-08 16:30 -------
Subject: Re: [arm] Combine cannot do its job because
immediate operand is used instead of register
On Mon, 2010-02-08 at 16:11 +0000, steven at gcc dot gnu dot org wrote:
> Can someone please explain what the expected code is?
Something like
stmfd sp!, {r3, r4, r5, lr}
mov r4, r0
mov r5, #255
mov r1, r4, lsr #24
mov r0, #8
bl func
and r1, r5, r4, lsr #16
mov r0, #8
bl func
mov r1, r5, r4, lsr #8
mov r0, #8
ldmfd sp!, {r3, r4, r5, lr}
b func
By putting 255 into a register we add one instruction, but remove 2; so
save one overall. This is one of the rare cases where an immediate is
actually more expensive on ARM than using a register.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9760
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register
[not found] <bug-9760-5458@http.gcc.gnu.org/bugzilla/>
2009-03-12 18:45 ` ramana dot r at gmail dot com
@ 2010-02-08 16:11 ` steven at gcc dot gnu dot org
2010-02-08 16:30 ` rearnsha at arm dot com
2010-02-08 16:31 ` rearnsha at arm dot com
3 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-02-08 16:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from steven at gcc dot gnu dot org 2010-02-08 16:11 -------
New test case is with func defined extern, as already mentioned in comment #5:
extern void func(char c, int t);
void foo(int u)
{
func ( 8, (u >> 24) & 0xffL );
func ( 8, (u >> 16) & 0xffL );
func ( 8, (u >> 8) & 0xffL );
}
Trunk today (r156595) produces this:
stmfd sp!, {r4, lr}
mov r4, r0
mov r1, r4, lsr #24
mov r0, #8
bl func
mov r1, r4, lsr #16
mov r0, #8
and r1, r1, #255
bl func
mov r1, r4, lsr #8
mov r0, #8
and r1, r1, #255
ldmfd sp!, {r4, lr}
b func
Can someone please explain what the expected code is?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9760
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register
[not found] <bug-9760-5458@http.gcc.gnu.org/bugzilla/>
@ 2009-03-12 18:45 ` ramana dot r at gmail dot com
2010-02-08 16:11 ` steven at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: ramana dot r at gmail dot com @ 2009-03-12 18:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from ramana dot r at gmail dot com 2009-03-12 18:45 -------
With Mainline today gcc produces :
stmfd sp!, {r4, lr}
mov r1, r0, lsr #24
mov r4, r0
mov r0, #8
bl func
mov r1, r4, lsr #16
and r1, r1, #255
mov r0, #8
bl func
mov r1, r4, lsr #8
and r1, r1, #255
mov r0, #8
ldmfd sp!, {r4, lr}
b func
The problem still exists. This can't be a problem with the combiner because the
combine would stop at function call boundaries.
--
ramana dot r at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rearnsha at arm dot com,
| |ramana dot r at gmail dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9760
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register
[not found] <20030219170600.9760.beszedes@rgai.hu>
` (3 preceding siblings ...)
2003-08-14 3:19 ` pinskia at gcc dot gnu dot org
@ 2004-08-20 6:42 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-20 6:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-20 06:42 -------
Note to reproduce this on the mainline you have remove the definition of the function func because
func is really a pure function and we remove the call to the function and the rest of the foo is really
dead code.
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2004-05-21 03:44:10 |2004-08-20 06:42:58
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9760
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register
[not found] <20030219170600.9760.beszedes@rgai.hu>
` (2 preceding siblings ...)
2003-06-02 1:18 ` pinskia@physics.uc.edu
@ 2003-08-14 3:19 ` pinskia at gcc dot gnu dot org
2004-08-20 6:42 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-14 3:19 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9760
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register
[not found] <20030219170600.9760.beszedes@rgai.hu>
2003-05-26 20:02 ` dhazeghi@yahoo.com
2003-05-26 20:18 ` pinskia@physics.uc.edu
@ 2003-06-02 1:18 ` pinskia@physics.uc.edu
2003-08-14 3:19 ` pinskia at gcc dot gnu dot org
2004-08-20 6:42 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 10+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-02 1:18 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9760
pinskia@physics.uc.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-06-02 01:18:46
date| |
------- Additional Comments From pinskia@physics.uc.edu 2003-06-02 01:18 -------
According to the submitter the problem still exists.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register
[not found] <20030219170600.9760.beszedes@rgai.hu>
2003-05-26 20:02 ` dhazeghi@yahoo.com
@ 2003-05-26 20:18 ` pinskia@physics.uc.edu
2003-06-02 1:18 ` pinskia@physics.uc.edu
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: pinskia@physics.uc.edu @ 2003-05-26 20:18 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9760
pinskia@physics.uc.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
------- Additional Comments From pinskia@physics.uc.edu 2003-05-26 20:09 -------
See Dara's question.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register
[not found] <20030219170600.9760.beszedes@rgai.hu>
@ 2003-05-26 20:02 ` dhazeghi@yahoo.com
2003-05-26 20:18 ` pinskia@physics.uc.edu
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: dhazeghi@yahoo.com @ 2003-05-26 20:02 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9760
------- Additional Comments From dhazeghi@yahoo.com 2003-05-26 19:49 -------
Hello,
with gcc 3.3 I get the following code:
.file "01.i"
.text
.align 2
.global func
.type func, %function
func:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
@ lr needed for prologue
mov pc, lr
.size func, .-func
.align 2
.global foo
.type foo, %function
foo:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {r4, fp, ip, lr, pc}
mov r1, r0, lsr #24
sub fp, ip, #4
mov r4, r0
mov r0, #8
bl func
mov r1, r4, asr #16
and r1, r1, #255
mov r0, #8
bl func
mov r4, r4, asr #8
and r4, r4, #255
mov r1, r4
mov r0, #8
ldmea fp, {r4, fp, sp, lr}
b func
.size foo, .-foo
.ident "GCC: (GNU) 3.3 20030508 (prerelease)"
with mainline, I get this slightly different code:
.file "01.i"
.text
.align 2
.global func
.type func, %function
func:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
@ lr needed for prologue
mov pc, lr
.size func, .-func
.align 2
.global foo
.type foo, %function
foo:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {r4, fp, ip, lr, pc}
mov r1, r0, lsr #24
sub fp, ip, #4
mov r4, r0
mov r0, #8
bl func
mov r1, r4, lsr #16
and r1, r1, #255
mov r0, #8
bl func
mov r4, r4, lsr #8
and r1, r4, #255
mov r0, #8
ldmea fp, {r4, fp, sp, lr}
b func
.size foo, .-foo
.ident "GCC: (GNU) 3.4 20030508 (experimental)"
Is this an improvement from the code you saw (sorry, I don't know arm asm, and there are too
many changes from the .s file you provided just to do a diff)? Thanks,
Dara
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-07-26 7:29 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-9760-4@http.gcc.gnu.org/bugzilla/>
2021-07-26 7:29 ` [Bug target/9760] [arm] Combine cannot do its job because immediate operand is used instead of register pinskia at gcc dot gnu.org
[not found] <bug-9760-5458@http.gcc.gnu.org/bugzilla/>
2009-03-12 18:45 ` ramana dot r at gmail dot com
2010-02-08 16:11 ` steven at gcc dot gnu dot org
2010-02-08 16:30 ` rearnsha at arm dot com
2010-02-08 16:31 ` rearnsha at arm dot com
[not found] <20030219170600.9760.beszedes@rgai.hu>
2003-05-26 20:02 ` dhazeghi@yahoo.com
2003-05-26 20:18 ` pinskia@physics.uc.edu
2003-06-02 1:18 ` pinskia@physics.uc.edu
2003-08-14 3:19 ` pinskia at gcc dot gnu dot org
2004-08-20 6:42 ` 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).