On 20/10/2023 12:51, Andrew Stubbs wrote:
I've committed this patch that allows building binaries for AMD gfx1030
GPUs. I can't actually test it, however, so somebody else will have to
debug it (or wait for me to get my hands on a device). Richi reports
that it does not execute correctly, as is.
The patch introduced a bug returning exit values that affected all the
targets. I've now committed a patch to fix the issue.
Andrew
amdgcn: Fix bug in gfx1030 support patch
The previous patch to add gfx1030 support introduced an issue with passing
exit codes from kernels run under gcn-run (offload kernels were unaffected).
gcc/ChangeLog:
PR target/112088
* config/gcn/gcn.cc (gcn_expand_epilogue): Fix kernel epilogue register
conflict.
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index 6f85f55803c..6a2aaefceca 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -3615,13 +3615,11 @@ gcn_expand_epilogue (void)
set_mem_addr_space (retptr_mem, ADDR_SPACE_SCALAR_FLAT);
emit_move_insn (kernarg_reg, retptr_mem);
- rtx retval_addr = gen_rtx_REG (DImode, FIRST_VPARM_REG);
+ rtx retval_addr = gen_rtx_REG (DImode, FIRST_VPARM_REG + 2);
emit_move_insn (retval_addr, kernarg_reg);
rtx retval_mem = gen_rtx_MEM (SImode, retval_addr);
- rtx scalar_retval = gen_rtx_REG (SImode, FIRST_VPARM_REG + 2);
set_mem_addr_space (retval_mem, ADDR_SPACE_FLAT);
- emit_move_insn (scalar_retval, gen_rtx_REG (SImode, RETURN_VALUE_REG));
- emit_move_insn (retval_mem, scalar_retval);
+ emit_move_insn (retval_mem, gen_rtx_REG (SImode, RETURN_VALUE_REG));
}
emit_jump_insn (gen_gcn_return ());