public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/115176] New: rbit pattern should use bitreverse rtl now
@ 2024-05-21 15:19 pinskia at gcc dot gnu.org
2024-05-21 15:21 ` [Bug target/115176] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-21 15:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115176
Bug ID: 115176
Summary: rbit pattern should use bitreverse rtl now
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: internal-improvement
Severity: enhancement
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
While looking at some code I noticed that it uses clang's __builtin_bitreverse8
builtin and looking at the aarch64 backend, I noticed the rbit patterns don't
use bitreverse but still an UNSPEC.
We should be able to change the pattern to use the rtl now.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/115176] rbit pattern should use bitreverse rtl now
2024-05-21 15:19 [Bug target/115176] New: rbit pattern should use bitreverse rtl now pinskia at gcc dot gnu.org
@ 2024-05-21 15:21 ` pinskia at gcc dot gnu.org
2024-05-22 1:06 ` xry111 at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-21 15:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115176
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2024-05-21
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
that is from aarch64-simd.md:
```
(define_insn "aarch64_rbit<mode><vczle><vczbe>"
[(set (match_operand:VB 0 "register_operand" "=w")
(unspec:VB [(match_operand:VB 1 "register_operand" "w")]
UNSPEC_RBIT))]
"TARGET_SIMD"
"rbit\\t%0.<Vbtype>, %1.<Vbtype>"
[(set_attr "type" "neon_rbit")]
)
```
From aarch64.md:
```
(define_insn "@aarch64_rbit<mode>"
[(set (match_operand:GPI 0 "register_operand" "=r")
(unspec:GPI [(match_operand:GPI 1 "register_operand" "r")]
UNSPEC_RBIT))]
""
"rbit\\t%<w>0, %<w>1"
[(set_attr "type" "rbit")]
)
```
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/115176] rbit pattern should use bitreverse rtl now
2024-05-21 15:19 [Bug target/115176] New: rbit pattern should use bitreverse rtl now pinskia at gcc dot gnu.org
2024-05-21 15:21 ` [Bug target/115176] " pinskia at gcc dot gnu.org
@ 2024-05-22 1:06 ` xry111 at gcc dot gnu.org
2024-06-12 0:03 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-05-22 1:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115176
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xry111 at gcc dot gnu.org
--- Comment #2 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
LoongArch currently has:
(define_insn "bitrev_4b"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec:SI [(match_operand:SI 1 "register_operand" "r")]
UNSPEC_BITREV_4B))]
""
"bitrev.4b\t%0,%1"
[(set_attr "type" "unknown")
(set_attr "mode" "SI")])
(define_insn "bitrev_8b"
[(set (match_operand:DI 0 "register_operand" "=r")
(unspec:DI [(match_operand:DI 1 "register_operand" "r")]
UNSPEC_BITREV_8B))]
""
"bitrev.8b\t%0,%1"
[(set_attr "type" "unknown")
(set_attr "mode" "DI")])
Maybe we can make them something like (subreg:DI (bitreverse:V8QI (subreg:QI
(match...) 0)) 0) instead. And LoongArch also has bitrev.{w/d} instructions
but GCC doesn't know them yet. I plan to add them after PR50481 is
implemented.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/115176] rbit pattern should use bitreverse rtl now
2024-05-21 15:19 [Bug target/115176] New: rbit pattern should use bitreverse rtl now pinskia at gcc dot gnu.org
2024-05-21 15:21 ` [Bug target/115176] " pinskia at gcc dot gnu.org
2024-05-22 1:06 ` xry111 at gcc dot gnu.org
@ 2024-06-12 0:03 ` pinskia at gcc dot gnu.org
2024-06-12 16:12 ` cvs-commit at gcc dot gnu.org
2024-06-12 16:12 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-12 0:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115176
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2024-June/65
| |4271.html
Keywords| |patch
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2024-June/654271.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/115176] rbit pattern should use bitreverse rtl now
2024-05-21 15:19 [Bug target/115176] New: rbit pattern should use bitreverse rtl now pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2024-06-12 0:03 ` pinskia at gcc dot gnu.org
@ 2024-06-12 16:12 ` cvs-commit at gcc dot gnu.org
2024-06-12 16:12 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-12 16:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115176
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:c2f0aaf7539c42b024ed6b3fb6909bd2c86bb206
commit r15-1216-gc2f0aaf7539c42b024ed6b3fb6909bd2c86bb206
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date: Tue Jun 11 20:36:34 2024 +0000
aarch64: Use bitreverse rtl code instead of unspec [PR115176]
Bitreverse rtl code was added with r14-1586-g6160572f8d243c. So let's
use it instead of an unspec. This is just a small cleanup but it does
have one small fix with respect to rtx costs which didn't handle vector
modes
correctly for the UNSPEC and now it does.
This is part of the first step in adding __builtin_bitreverse's builtins
but it is independent of it though.
Bootstrapped and tested on aarch64-linux-gnu with no regressions.
gcc/ChangeLog:
PR target/115176
* config/aarch64/aarch64-simd.md
(aarch64_rbit<mode><vczle><vczbe>): Use
bitreverse instead of unspec.
* config/aarch64/aarch64-sve-builtins-base.cc (svrbit): Convert
over to using
rtx_code_function instead of unspec_based_function.
* config/aarch64/aarch64-sve.md: Update comment where RBIT is
included.
* config/aarch64/aarch64.cc (aarch64_rtx_costs): Handle BITREVERSE
like BSWAP.
Remove UNSPEC_RBIT support.
* config/aarch64/aarch64.md (unspec): Remove UNSPEC_RBIT.
(aarch64_rbit<mode>): Use bitreverse instead of unspec.
* config/aarch64/iterators.md (SVE_INT_UNARY): Add bitreverse.
(optab): Likewise.
(sve_int_op): Likewise.
(SVE_INT_UNARY): Remove UNSPEC_RBIT.
(optab): Likewise.
(sve_int_op): Likewise.
(min_elem_bits): Likewise.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/115176] rbit pattern should use bitreverse rtl now
2024-05-21 15:19 [Bug target/115176] New: rbit pattern should use bitreverse rtl now pinskia at gcc dot gnu.org
` (3 preceding siblings ...)
2024-06-12 16:12 ` cvs-commit at gcc dot gnu.org
@ 2024-06-12 16:12 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-12 16:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115176
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |15.0
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-12 16:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-21 15:19 [Bug target/115176] New: rbit pattern should use bitreverse rtl now pinskia at gcc dot gnu.org
2024-05-21 15:21 ` [Bug target/115176] " pinskia at gcc dot gnu.org
2024-05-22 1:06 ` xry111 at gcc dot gnu.org
2024-06-12 0:03 ` pinskia at gcc dot gnu.org
2024-06-12 16:12 ` cvs-commit at gcc dot gnu.org
2024-06-12 16:12 ` 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).