diff options
author | Andrew Stubbs <ams@codesourcery.com> | 2019-07-19 17:06:50 +0100 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2020-03-03 12:51:25 +0100 |
commit | 993d229d9afc275a5f44023d74098bbf03200d97 (patch) | |
tree | be0420928f10f746dd62f1f91e30daa2c1ab412a | |
parent | 4b134d6cd7a9c14976d9f0ed91b23d0cab88bdbe (diff) | |
download | gcc-993d229d9afc275a5f44023d74098bbf03200d97.zip gcc-993d229d9afc275a5f44023d74098bbf03200d97.tar.gz gcc-993d229d9afc275a5f44023d74098bbf03200d97.tar.bz2 |
Use GFX9 granulated sgprs count correctly.
2019-09-10 Andrew Stubbs <ams@codesourcery.com>
gcc/
* config/gcn/gcn.c (gcn_hsa_declare_function_name): Calculate
granulated_sgprs according to architecture.
(cherry picked from openacc-gcc-9-branch commit
68e905b7879641dbae193cec7db71e62b48145c1)
-rw-r--r-- | gcc/ChangeLog.omp | 5 | ||||
-rw-r--r-- | gcc/config/gcn/gcn.c | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index c44cffb..7a3cc7f 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,8 @@ +2019-09-10 Andrew Stubbs <ams@codesourcery.com> + + * config/gcn/gcn.c (gcn_hsa_declare_function_name): Calculate + granulated_sgprs according to architecture. + 2019-09-09 Andrew Stubbs <ams@codesourcery.com> * config/gcn/gcn-run.c (heap_region): New global variable. diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index 66854b6..f8434e4 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -4884,6 +4884,14 @@ gcn_hsa_declare_function_name (FILE *file, const char *name, tree) sgpr = 102 - extra_regs; } + /* GFX8 allocates SGPRs in blocks of 8. + GFX9 uses blocks of 16. */ + int granulated_sgprs; + if (TARGET_GCN3) + granulated_sgprs = (sgpr + extra_regs + 7) / 8 - 1; + else if (TARGET_GCN5) + granulated_sgprs = 2 * ((sgpr + extra_regs + 15) / 16 - 1); + fputs ("\t.align\t256\n", file); fputs ("\t.type\t", file); assemble_name (file, name); @@ -4922,7 +4930,7 @@ gcn_hsa_declare_function_name (FILE *file, const char *name, tree) "\t\tcompute_pgm_rsrc2_excp_en = 0\n", (vgpr - 1) / 4, /* Must match wavefront_sgpr_count */ - (sgpr + extra_regs + 7) / 8 - 1, + granulated_sgprs, /* The total number of SGPR user data registers requested. This number must match the number of user data registers enabled. */ cfun->machine->args.nsgprs); |