public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Kewen Lin <linkw@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6621] rs6000: Use known constant for GET_MODE_NUNITS and similar Date: Mon, 17 Jan 2022 05:44:04 +0000 (GMT) [thread overview] Message-ID: <20220117054404.DD73A3858402@sourceware.org> (raw) https://gcc.gnu.org/g:b3e77224edbcb06cfd6ef585c11fc2c7d9672a16 commit r12-6621-gb3e77224edbcb06cfd6ef585c11fc2c7d9672a16 Author: Kewen Lin <linkw@linux.ibm.com> Date: Sun Jan 16 22:55:42 2022 -0600 rs6000: Use known constant for GET_MODE_NUNITS and similar This patch is to clean up some codes with GET_MODE_UNIT_SIZE or GET_MODE_NUNITS, which can use known constants or just be removed. Note that Carl Love helped to confirm altivec_vreveti2 introduced in r12-1341 is useless and can be removed. gcc/ChangeLog: * config/rs6000/altivec.md (altivec_vreveti2): Remove. * config/rs6000/vsx.md (*vsx_extract_si, *vsx_extract_si_<uns>float_df, *vsx_extract_si_<uns>float_<mode>, *vsx_insert_extract_v4sf_p9): Use known constant values to simplify code. Diff: --- gcc/config/rs6000/altivec.md | 25 ------------------------- gcc/config/rs6000/vsx.md | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index d7e93f2b0c6..efc8ae35c2e 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -3961,31 +3961,6 @@ DONE; }) -;; Vector reverse elements -(define_expand "altivec_vreveti2" - [(set (match_operand:TI 0 "register_operand" "=v") - (unspec:TI [(match_operand:TI 1 "register_operand" "v")] - UNSPEC_VREVEV))] - "TARGET_ALTIVEC" -{ - int i, j, size, num_elements; - rtvec v = rtvec_alloc (16); - rtx mask = gen_reg_rtx (V16QImode); - - size = GET_MODE_UNIT_SIZE (TImode); - num_elements = GET_MODE_NUNITS (TImode); - - for (j = 0; j < num_elements; j++) - for (i = 0; i < size; i++) - RTVEC_ELT (v, i + j * size) - = GEN_INT (i + (num_elements - 1 - j) * size); - - emit_insn (gen_vec_initv16qiqi (mask, gen_rtx_PARALLEL (V16QImode, v))); - emit_insn (gen_altivec_vperm_ti (operands[0], operands[1], - operands[1], mask)); - DONE; -}) - ;; Vector reverse elements for V16QI V8HI V4SI V4SF (define_expand "altivec_vreve<mode>2" [(set (match_operand:VEC_K 0 "register_operand" "=v") diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 65bbc763eb0..e84ffb6a6db 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -3854,8 +3854,10 @@ rtx vec_tmp = operands[3]; int value; + /* Adjust index for LE element ordering, the below minuend 3 is computed by + GET_MODE_NUNITS (V4SImode) - 1. */ if (!BYTES_BIG_ENDIAN) - element = GEN_INT (GET_MODE_NUNITS (V4SImode) - 1 - INTVAL (element)); + element = GEN_INT (3 - INTVAL (element)); /* If the value is in the correct position, we can avoid doing the VSPLT<x> instruction. */ @@ -4230,8 +4232,10 @@ rtx v4si_tmp = operands[3]; int value; + /* Adjust index for LE element ordering, the below minuend 3 is computed by + GET_MODE_NUNITS (V4SImode) - 1. */ if (!BYTES_BIG_ENDIAN) - element = GEN_INT (GET_MODE_NUNITS (V4SImode) - 1 - INTVAL (element)); + element = GEN_INT (3 - INTVAL (element)); /* If the value is in the correct position, we can avoid doing the VSPLT<x> instruction. */ @@ -4273,8 +4277,10 @@ rtx df_tmp = operands[4]; int value; + /* Adjust index for LE element ordering, the below minuend 3 is computed by + GET_MODE_NUNITS (V4SImode) - 1. */ if (!BYTES_BIG_ENDIAN) - element = GEN_INT (GET_MODE_NUNITS (V4SImode) - 1 - INTVAL (element)); + element = GEN_INT (3 - INTVAL (element)); /* If the value is in the correct position, we can avoid doing the VSPLT<x> instruction. */ @@ -4466,8 +4472,10 @@ { int ele = INTVAL (operands[4]); + /* Adjust index for LE element ordering, the below minuend 3 is computed by + GET_MODE_NUNITS (V4SFmode) - 1. */ if (!BYTES_BIG_ENDIAN) - ele = GET_MODE_NUNITS (V4SFmode) - 1 - ele; + ele = 3 - ele; operands[4] = GEN_INT (GET_MODE_SIZE (SFmode) * ele); return "xxinsertw %x0,%x2,%4";
reply other threads:[~2022-01-17 5:44 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=20220117054404.DD73A3858402@sourceware.org \ --to=linkw@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).