public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/31271] Missing simple optimization
[not found] <bug-31271-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-16 1:37 ` pinskia at gcc dot gnu.org
2023-05-20 2:48 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-16 1:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31271
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Known to work|4.7.1 |
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
We produce in 4.7.0+
in_canforward(unsigned int):
.LFB0:
.cfi_startproc
andl $224, %edi
xorl %eax, %eax
cmpl $224, %edi
setne %al
ret
That is:
D.2201_1 = in_2(D) & 224;
D.2199_10 = D.2201_1 != 224;
I think we could do slightly better
((~in_2(D)) & 224) == 0
But only at exand time.
This gives:
notl %edi
xorl %eax, %eax
testb $-32, %dil
setne %al
Or for aarch64:
mov w8, #224
bics wzr, w8, w0
cset w0, ne
ret
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug middle-end/31271] Missing simple optimization
[not found] <bug-31271-4@http.gcc.gnu.org/bugzilla/>
2021-08-16 1:37 ` [Bug middle-end/31271] Missing simple optimization pinskia at gcc dot gnu.org
@ 2023-05-20 2:48 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-20 2:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31271
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.7.0
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
>
> I think we could do slightly better
> ((~in_2(D)) & 224) == 0
>
> But only at exand time.
> This gives:
> notl %edi
> xorl %eax, %eax
> testb $-32, %dil
> setne %al
x86_64 produces that in GCC 13 with r13-792-g29ae455901ac71 .
>
> Or for aarch64:
> mov w8, #224
> bics wzr, w8, w0
> cset w0, ne
> ret
For aarch64, it could define an instruction to catch:
(set (reg:CC_NZV 66 cc)
(compare:CC_NZV (and:SI (not:SI (reg:SI 100))
(const_int 224 [0xe0]))
(const_int 0 [0])))
Anyways the original issue was fixed in GCC 4.7.0 and the small improvement for
x86_64 is in GCC 13. The aarch64 code generation is currently:
and w0, w0, 224
cmp w0, 224
cset w0, ne
ret
Which is only slightly worse than what I proposed too.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug middle-end/31271] Missing simple optimization
2007-03-19 22:22 [Bug rtl-optimization/31271] New: " matt at 3am-software dot com
@ 2007-03-20 10:39 ` rguenth at gcc dot gnu dot org
0 siblings, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-03-20 10:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2007-03-20 10:39 -------
Confirmed. This is neither done at the tree nor at the rtl level.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Component|rtl-optimization |middle-end
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-03-20 10:39:11
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31271
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-20 2:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-31271-4@http.gcc.gnu.org/bugzilla/>
2021-08-16 1:37 ` [Bug middle-end/31271] Missing simple optimization pinskia at gcc dot gnu.org
2023-05-20 2:48 ` pinskia at gcc dot gnu.org
2007-03-19 22:22 [Bug rtl-optimization/31271] New: " matt at 3am-software dot com
2007-03-20 10:39 ` [Bug middle-end/31271] " rguenth 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).