public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106536] New: P9: gcc does not detect setb pattern
@ 2022-08-05 10:17 jens.seifert at de dot ibm.com
2022-09-13 16:25 ` [Bug target/106536] " segher at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: jens.seifert at de dot ibm.com @ 2022-08-05 10:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106536
Bug ID: 106536
Summary: P9: gcc does not detect setb pattern
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: jens.seifert at de dot ibm.com
Target Milestone: ---
int compare2(unsigned long long a, unsigned long long b)
{
return (a > b ? 1 : (a < b ? -1 : 0));
}
Output:
_Z8compare2yy:
cmpld 0,3,4
bgt 0,.L5
mfcr 3,128
rlwinm 3,3,1,1
neg 3,3
blr
.L5:
li 3,1
blr
.long 0
.byte 0,9,0,0,0,0,0,0
clang generates:
_Z8compare2yy: # @_Z8compare2yy
cmpld 3, 4
setb 3, 0
extsw 3, 3
blr
.long 0
.quad 0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/106536] P9: gcc does not detect setb pattern
2022-08-05 10:17 [Bug target/106536] New: P9: gcc does not detect setb pattern jens.seifert at de dot ibm.com
@ 2022-09-13 16:25 ` segher at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: segher at gcc dot gnu.org @ 2022-09-13 16:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106536
Segher Boessenkool <segher at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2022-09-13
Status|UNCONFIRMED |NEW
CC| |segher at gcc dot gnu.org
--- Comment #1 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Confirmed.
GCC uses conditional branches here in expand already. It is hard to optimise
this over that.
Using -mcpu=power10 we don't get conditional branches:
cmpld 7,3,4 # 8 [c=4 l=4] *cmpdi_unsigned
li 9,1 # 43 [c=4 l=4] *movsi_internal1/8
cmpld 0,3,4 # 45 [c=4 l=4] *cmpdi_unsigned
setnbc 10,28 # 44 [c=4 l=4] *setnbc_unsigned_si
isel 3,9,10,1 # 46 [c=4 l=4] isel_unsigned_si/1
extsw 3,3 # 24 [c=4 l=4] extendsidi2/1
blr # 51 [c=4 l=4] simple_return
but this of course isn't ideal yet either. The branches aren't fully optimised
away until ce2, which is *after* combine. ce1 didn't catch this, perhaps
because
the two conditional assignments are a bit intertwined there?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-13 16:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 10:17 [Bug target/106536] New: P9: gcc does not detect setb pattern jens.seifert at de dot ibm.com
2022-09-13 16:25 ` [Bug target/106536] " segher 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).