From: Jeremy_Robinson <[email protected]>

When an insn in a SIMT region uses a SYMBOL_REF, simt_vect loads it into
a scalar register with movdi_symbol and broadcasts it.  Symbols in the LDS
address space, such as OpenACC gang-private variables, are SImode, and
movdi_symbol then yields an SImode set with an SCC clobber that matches no
pattern: at -O0 (where the address is not hoisted out of the region),
OpenACC code with a gang-private array ICEs in extract_insn
("unrecognizable insn") in SIMT modes.  Use a plain move for them.

Assisted-by: Claude Opus 5.5

gcc/ChangeLog:

        * config/gcn/gcn-simt-vectorize.cc
        (pass_gcn_simt_vectorize::execute): Use a plain SET instead of
        gen_movdi_symbol for non-DImode SYMBOL_REFs and LABEL_REFs.
---
 gcc/config/gcn/gcn-simt-vectorize.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/config/gcn/gcn-simt-vectorize.cc 
b/gcc/config/gcn/gcn-simt-vectorize.cc
index 3c35d1878f9d5..499b9bdab8696 100644
--- a/gcc/config/gcn/gcn-simt-vectorize.cc
+++ b/gcc/config/gcn/gcn-simt-vectorize.cc
@@ -1621,7 +1621,12 @@ pass_gcn_simt_vectorize::execute (function *fn)
                  if (special_attr != SIMT_SPECIAL_SYMBOLS_OK)
                    {
                      rtx tmpdi = gen_reg_rtx (GET_MODE (x));
-                     rtx movdi_symbol = gen_movdi_symbol (tmpdi, x);
+                     /* Symbols in the LDS address space (e.g. OpenACC
+                        gang-private variables) are SImode; a plain move
+                        loads them.  */
+                     rtx movdi_symbol = (GET_MODE (x) == DImode
+                                         ? gen_movdi_symbol (tmpdi, x)
+                                         : gen_rtx_SET (tmpdi, x));
                      emit_insn_before (movdi_symbol, insn);
 
                      rtx tmpv64di = gen_reg_rtx (insn_mode);
-- 
2.56.0

Reply via email to