public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r15-648] nvptx: Correct pattern for popcountdi2 insn in nvptx.md.
@ 2024-05-19 8:51 Roger Sayle
0 siblings, 0 replies; only message in thread
From: Roger Sayle @ 2024-05-19 8:51 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1676ef6e91b902f592270e4bcf10b4fc342e200d
commit r15-648-g1676ef6e91b902f592270e4bcf10b4fc342e200d
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Sun May 19 09:49:45 2024 +0100
nvptx: Correct pattern for popcountdi2 insn in nvptx.md.
The result of a POPCOUNT operation in RTL should have the same mode
as its operand. This corrects the specification of popcount in
the nvptx backend, splitting the current generic define_insn into
two, one for popcountsi2 and the other for popcountdi2 (the latter
with an explicit truncate).
2024-05-19 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/nvptx/nvptx.md (popcount<mode>2): Split into...
(popcountsi2): define_insn handling SImode popcount.
(popcountdi2): define_insn handling DImode popcount, with an
explicit truncate:SI to produce an SImode result.
Diff:
---
gcc/config/nvptx/nvptx.md | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md
index 96e6c9116080..ef7e3fb00fac 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -655,11 +655,18 @@
DONE;
})
-(define_insn "popcount<mode>2"
+(define_insn "popcountsi2"
[(set (match_operand:SI 0 "nvptx_register_operand" "=R")
- (popcount:SI (match_operand:SDIM 1 "nvptx_register_operand" "R")))]
+ (popcount:SI (match_operand:SI 1 "nvptx_register_operand" "R")))]
""
- "%.\\tpopc.b%T1\\t%0, %1;")
+ "%.\\tpopc.b32\\t%0, %1;")
+
+(define_insn "popcountdi2"
+ [(set (match_operand:SI 0 "nvptx_register_operand" "=R")
+ (truncate:SI
+ (popcount:DI (match_operand:DI 1 "nvptx_register_operand" "R"))))]
+ ""
+ "%.\\tpopc.b64\\t%0, %1;")
;; Multiplication variants
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-19 8:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-19 8:51 [gcc r15-648] nvptx: Correct pattern for popcountdi2 insn in nvptx.md Roger Sayle
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).