From: Andrew Stubbs Date: Tue, 25 Jun 2019 09:47:15 +0000 (+0000) Subject: GCN: Wait for exit value to write before exiting. X-Git-Tag: releases/gcc-9.2.0~205 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47fd1a83477b235fbf07355d8298d55eee209b8d;p=thirdparty%2Fgcc.git GCN: Wait for exit value to write before exiting. 2019-06-25 Andrew Stubbs Backport from mainline 2019-05-24 Andrew Stubbs gcc/ * config/gcn/gcn-run.c (main): Set a non-zero return value if the kernel does not exit cleanly. * config/gcn/gcn.md (gcn_return): Insert s_waitcnt before s_dcache_wb. From-SVN: r272642 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8e9c869eee4c..90afe483b227 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-06-25 Andrew Stubbs + + Backport from mainline + 2019-05-24 Andrew Stubbs + + * config/gcn/gcn-run.c (main): Set a non-zero return value if the + kernel does not exit cleanly. + * config/gcn/gcn.md (gcn_return): Insert s_waitcnt before s_dcache_wb. + 2019-06-25 Andrew Stubbs Backport from mainline diff --git a/gcc/config/gcn/gcn-run.c b/gcc/config/gcn/gcn-run.c index 00a71014c204..d3def1369c71 100644 --- a/gcc/config/gcn/gcn-run.c +++ b/gcc/config/gcn/gcn-run.c @@ -829,7 +829,10 @@ main (int argc, char *argv[]) unsigned int upper = (return_value & ~0xffff) >> 16; if (upper == 0xcafe) - printf ("Kernel exit value was never set\n"); + { + printf ("Kernel exit value was never set\n"); + return_value = 0xff; + } else if (upper == 0xffff) ; /* Set by exit. */ else if (upper == 0) diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md index 2b805a73c561..1f06d0bd5cc9 100644 --- a/gcc/config/gcn/gcn.md +++ b/gcc/config/gcn/gcn.md @@ -784,10 +784,10 @@ if (cfun && cfun->machine && cfun->machine->normal_function) return "s_setpc_b64\ts[18:19]"; else - return "s_dcache_wb\;s_endpgm"; + return "s_waitcnt\tlgkmcnt(0)\;s_dcache_wb\;s_endpgm"; } [(set_attr "type" "sop1") - (set_attr "length" "8")]) + (set_attr "length" "12")]) (define_expand "call" [(parallel [(call (match_operand 0 "")