public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Stubbs <ams@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-13] amdgcn: simplify secondary reload patterns Date: Tue, 28 Nov 2023 11:06:46 +0000 (GMT) [thread overview] Message-ID: <20231128110646.C4E5E3857B83@sourceware.org> (raw) https://gcc.gnu.org/g:05fe35e548499b57e164e76fc13de1ddc3373aba commit 05fe35e548499b57e164e76fc13de1ddc3373aba Author: Andrew Stubbs <ams@codesourcery.com> Date: Fri Oct 6 11:14:05 2023 +0100 amdgcn: simplify secondary reload patterns Remove some unnecessary complexity; no functional change is intended, although LRA appears to use the constraints from the reload_in/out patterns, so it's probably an improvement for it to see the real sgprbase constraints. gcc/ChangeLog: * config/gcn/gcn-valu.md (mov<mode>_sgprbase): Add @ modifier. (reload_in<mode>): Delete. (reload_out<mode>): Delete. * config/gcn/gcn.cc (CODE_FOR): Delete. (get_code_for_##PREFIX##vN##SUFFIX): Delete. (CODE_FOR_OP): Delete. (get_code_for_##PREFIX): Delete. (gcn_secondary_reload): Replace "get_code_for" with "code_for". (cherry picked from commit a0e6306b7ee16ce4ef067c00609d1303fed71c74) Diff: --- gcc/ChangeLog.omp | 14 +++++++++++ gcc/config/gcn/gcn-valu.md | 31 +++-------------------- gcc/config/gcn/gcn.cc | 63 +--------------------------------------------- 3 files changed, 18 insertions(+), 90 deletions(-) diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index 02f3ac2c105..16384e14a40 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,17 @@ +2023-11-28 Andrew Stubbs <ams@codesourcery.com> + + Backport from mainline: + Andrew Stubbs <ams@codesourcery.com> + + * config/gcn/gcn-valu.md (mov<mode>_sgprbase): Add @ modifier. + (reload_in<mode>): Delete. + (reload_out<mode>): Delete. + * config/gcn/gcn.cc (CODE_FOR): Delete. + (get_code_for_##PREFIX##vN##SUFFIX): Delete. + (CODE_FOR_OP): Delete. + (get_code_for_##PREFIX): Delete. + (gcn_secondary_reload): Replace "get_code_for" with "code_for". + 2023-11-10 Andrew Stubbs <ams@codesourcery.com> Backport from mainline: diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md index 2e8eea4ab5c..a01712543d5 100644 --- a/gcc/config/gcn/gcn-valu.md +++ b/gcc/config/gcn/gcn-valu.md @@ -641,7 +641,7 @@ ; vT += Sv ; flat_load v, vT -(define_insn "mov<mode>_sgprbase" +(define_insn "@mov<mode>_sgprbase" [(set (match_operand:V_1REG 0 "nonimmediate_operand") (unspec:V_1REG [(match_operand:V_1REG 1 "general_operand")] @@ -655,7 +655,7 @@ [m,v ,&v;* ,12] # }) -(define_insn "mov<mode>_sgprbase" +(define_insn "@mov<mode>_sgprbase" [(set (match_operand:V_2REG 0 "nonimmediate_operand" "= v, v, m") (unspec:V_2REG [(match_operand:V_2REG 1 "general_operand" "vDB, m, v")] @@ -672,7 +672,7 @@ [(set_attr "type" "vmult,*,*") (set_attr "length" "8,12,12")]) -(define_insn "mov<mode>_sgprbase" +(define_insn "@mov<mode>_sgprbase" [(set (match_operand:V_4REG 0 "nonimmediate_operand") (unspec:V_4REG [(match_operand:V_4REG 1 "general_operand")] @@ -685,31 +685,6 @@ [m,v ,&v;* ,12] # }) -; reload_in was once a standard name, but here it's only referenced by -; gcn_secondary_reload. It allows a reload with a scratch register. - -(define_expand "reload_in<mode>" - [(set (match_operand:V_MOV 0 "register_operand" "= v") - (match_operand:V_MOV 1 "memory_operand" " m")) - (clobber (match_operand:<VnDI> 2 "register_operand" "=&v"))] - "" - { - emit_insn (gen_mov<mode>_sgprbase (operands[0], operands[1], operands[2])); - DONE; - }) - -; reload_out is similar to reload_in, above. - -(define_expand "reload_out<mode>" - [(set (match_operand:V_MOV 0 "memory_operand" "= m") - (match_operand:V_MOV 1 "register_operand" " v")) - (clobber (match_operand:<VnDI> 2 "register_operand" "=&v"))] - "" - { - emit_insn (gen_mov<mode>_sgprbase (operands[0], operands[1], operands[2])); - DONE; - }) - ; Expand scalar addresses into gather/scatter patterns (define_split diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index eb1232ade5c..2191b203721 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -1396,64 +1396,6 @@ GEN_VN_NOEXEC (vec_series,si, A(rtx dest, rtx x, rtx c), A(dest, x, c)) #undef GET_VN_FN #undef A -/* Get icode for vector instructions without an optab. */ - -#define CODE_FOR(PREFIX, SUFFIX) \ -static int \ -get_code_for_##PREFIX##vN##SUFFIX (int nunits) \ -{ \ - switch (nunits) \ - { \ - case 2: return CODE_FOR_##PREFIX##v2##SUFFIX; \ - case 4: return CODE_FOR_##PREFIX##v4##SUFFIX; \ - case 8: return CODE_FOR_##PREFIX##v8##SUFFIX; \ - case 16: return CODE_FOR_##PREFIX##v16##SUFFIX; \ - case 32: return CODE_FOR_##PREFIX##v32##SUFFIX; \ - case 64: return CODE_FOR_##PREFIX##v64##SUFFIX; \ - } \ - \ - gcc_unreachable (); \ - return CODE_FOR_nothing; \ -} - -#define CODE_FOR_OP(PREFIX) \ - CODE_FOR (PREFIX, qi) \ - CODE_FOR (PREFIX, hi) \ - CODE_FOR (PREFIX, hf) \ - CODE_FOR (PREFIX, si) \ - CODE_FOR (PREFIX, sf) \ - CODE_FOR (PREFIX, di) \ - CODE_FOR (PREFIX, df) \ - CODE_FOR (PREFIX, ti) \ -static int \ -get_code_for_##PREFIX (machine_mode mode) \ -{ \ - int vf = GET_MODE_NUNITS (mode); \ - machine_mode smode = GET_MODE_INNER (mode); \ - \ - switch (smode) \ - { \ - case E_QImode: return get_code_for_##PREFIX##vNqi (vf); \ - case E_HImode: return get_code_for_##PREFIX##vNhi (vf); \ - case E_HFmode: return get_code_for_##PREFIX##vNhf (vf); \ - case E_SImode: return get_code_for_##PREFIX##vNsi (vf); \ - case E_SFmode: return get_code_for_##PREFIX##vNsf (vf); \ - case E_DImode: return get_code_for_##PREFIX##vNdi (vf); \ - case E_DFmode: return get_code_for_##PREFIX##vNdf (vf); \ - case E_TImode: return get_code_for_##PREFIX##vNti (vf); \ - default: break; \ - } \ - \ - gcc_unreachable (); \ - return CODE_FOR_nothing; \ -} - -CODE_FOR_OP (reload_in) -CODE_FOR_OP (reload_out) - -#undef CODE_FOR_OP -#undef CODE_FOR - /* Return true if OP is a PARALLEL of CONST_INTs that form a linear series with step STEP. */ @@ -2478,10 +2420,7 @@ gcn_secondary_reload (bool in_p, rtx x, reg_class_t rclass, if (GET_MODE_CLASS (reload_mode) == MODE_VECTOR_INT || GET_MODE_CLASS (reload_mode) == MODE_VECTOR_FLOAT) { - if (in_p) - sri->icode = get_code_for_reload_in (reload_mode); - else - sri->icode = get_code_for_reload_out (reload_mode); + sri->icode = code_for_mov_sgprbase (reload_mode); break; } /* Fallthrough. */
reply other threads:[~2023-11-28 11:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231128110646.C4E5E3857B83@sourceware.org \ --to=ams@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).