https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104440
--- Comment #9 from Tom de Vries <vries at gcc dot gnu.org> --- (In reply to Tom de Vries from comment #1) > Tentative patch that fixes example: > ... > diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc > index 5b26c0f4c7dd..4dc154434853 100644 > --- a/gcc/config/nvptx/nvptx.cc > +++ b/gcc/config/nvptx/nvptx.cc > @@ -1565,6 +1565,23 @@ nvptx_declare_function_name (FILE *file, const char > *name, cons > t_tree decl) > fprintf (file, "\t.reg%s ", nvptx_ptx_type_from_mode (mode, true)); > output_reg (file, i, split, -2); > fprintf (file, ";\n"); > + switch (mode) > + { > + case HImode: > + fprintf (file, "\tmov.u16 %%r%d, 0;\n", i); > + break; > + case SImode: > + fprintf (file, "\tmov.u32 %%r%d, 0;\n", i); > + break; > + case DImode: > + fprintf (file, "\tmov.u64 %%r%d, 0;\n", i); > + break; > + case BImode: > + fprintf (file, "\tsetp.ne.u32 %%r%d,0,0;\n", i); > + break; > + default: > + gcc_unreachable (); > + } > } > } > > ... FWIW, I've tested this patch (extended a bit to handle all cases) but ran into trouble in the libgomp testsuite, with running out of resources. So this approach is too resource-hungry.