public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/110479] New: Unnecessary register move
@ 2023-06-29 8:03 tkoenig at gcc dot gnu.org
2023-06-29 12:41 ` [Bug rtl-optimization/110479] " ubizjak at gmail dot com
2023-06-29 15:21 ` tkoenig at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-06-29 8:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110479
Bug ID: 110479
Summary: Unnecessary register move
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Target Milestone: ---
May be related to / a dup of PR110240.
The function
unsigned int bar(unsigned int a)
{
return 1u << (((a >> 10) & 3) + 3);
}
is compiled, with a relatively recent trunk and -O3, to
bar:
.LFB12:
.cfi_startproc
shrl $10, %edi
movl $1, %eax
movl %edi, %ecx
andl $3, %ecx
addl $3, %ecx
sall %cl, %eax
ret
where the register move seems unnecessary.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/110479] Unnecessary register move
2023-06-29 8:03 [Bug rtl-optimization/110479] New: Unnecessary register move tkoenig at gcc dot gnu.org
@ 2023-06-29 12:41 ` ubizjak at gmail dot com
2023-06-29 15:21 ` tkoenig at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: ubizjak at gmail dot com @ 2023-06-29 12:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110479
--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Thomas Koenig from comment #0)
> movl %edi, %ecx
This one? It is needed because SAL wants its count argument in %cl and first
argument is passed in %edi (mandated by x86_64 ABI).
With -mbmi2, one gets:
shrl $10, %edi
movl $1, %eax
andl $3, %edi
addl $3, %edi
shlx %edi, %eax, %eax
ret
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/110479] Unnecessary register move
2023-06-29 8:03 [Bug rtl-optimization/110479] New: Unnecessary register move tkoenig at gcc dot gnu.org
2023-06-29 12:41 ` [Bug rtl-optimization/110479] " ubizjak at gmail dot com
@ 2023-06-29 15:21 ` tkoenig at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-06-29 15:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110479
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #1)
> (In reply to Thomas Koenig from comment #0)
>
> > movl %edi, %ecx
>
> This one? It is needed because SAL wants its count argument in %cl and first
> argument is passed in %edi (mandated by x86_64 ABI).
>
> With -mbmi2, one gets:
>
> shrl $10, %edi
> movl $1, %eax
> andl $3, %edi
> addl $3, %edi
> shlx %edi, %eax, %eax
> ret
Hm, you're right. The intricacies of x86...
Closing.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-29 15:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 8:03 [Bug rtl-optimization/110479] New: Unnecessary register move tkoenig at gcc dot gnu.org
2023-06-29 12:41 ` [Bug rtl-optimization/110479] " ubizjak at gmail dot com
2023-06-29 15:21 ` tkoenig 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).