public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/109832] New: aarch64: Inefficient code for logical or of two booleans
@ 2023-05-12 15:29 acoplan at gcc dot gnu.org
2023-05-12 17:48 ` [Bug target/109832] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: acoplan at gcc dot gnu.org @ 2023-05-12 15:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109832
Bug ID: 109832
Summary: aarch64: Inefficient code for logical or of two
booleans
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
For the following testcase:
bool f(bool x, bool y) {
return x || y;
}
on AArch64 at -O2 we generate the rather convoluted:
f:
and w1, w1, 255
tst w0, 255
ccmp w1, 0, 0, eq
cset w0, ne
ret
but clang gives the more optimal:
f: // @f
orr w8, w0, w1
and w0, w8, #0x1
ret
we should probably do what clang does here.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/109832] aarch64: Inefficient code for logical or of two booleans
2023-05-12 15:29 [Bug target/109832] New: aarch64: Inefficient code for logical or of two booleans acoplan at gcc dot gnu.org
@ 2023-05-12 17:48 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-12 17:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109832
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is only arguments which get wrong.
That is:
bool f(bool &x, bool &y) {
return x | y;
}
Produces:
ldrb w2, [x0]
ldrb w0, [x1]
orr w0, w2, w0
ret
This is a dup of bug 101806 then.
*** This bug has been marked as a duplicate of bug 101806 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-12 17:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-12 15:29 [Bug target/109832] New: aarch64: Inefficient code for logical or of two booleans acoplan at gcc dot gnu.org
2023-05-12 17:48 ` [Bug target/109832] " 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).