From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1816) id 716B3385840D; Wed, 26 Apr 2023 14:11:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 716B3385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682518309; bh=rzPwbuu46zrNO4WDv1uX9/J+9Mu9Gx/oYZ+qXtA6g3g=; h=From:To:Subject:Date:From; b=hkI4LGc4BxdwEEfSQZAoGTBS8raTsxQNHXj0sihMN/dAnEoC/5Dl0DkhARp4Ihz3M vyXyAOzhm6cJk4dcpqA3cYOwR5nrf75sr/ZRMVySRB+xR8/rPKDFO6fXfw8K1J/7CV pDQYA0pv3DDtos7OBwEMGhfYDTJlwkuixDUnDp/I= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Kyrylo Tkachov To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-267] aarch64: Reimplement RSHRN2 intrinsic patterns with standard RTL codes X-Act-Checkin: gcc X-Git-Author: Kyrylo Tkachov X-Git-Refname: refs/heads/master X-Git-Oldrev: 80afac3121778e509e1847be90a1999236cff03a X-Git-Newrev: b4c69e6b663753f41259e2e19ad03cfc11457534 Message-Id: <20230426141149.716B3385840D@sourceware.org> Date: Wed, 26 Apr 2023 14:11:49 +0000 (GMT) List-Id: https://gcc.gnu.org/g:b4c69e6b663753f41259e2e19ad03cfc11457534 commit r14-267-gb4c69e6b663753f41259e2e19ad03cfc11457534 Author: Kyrylo Tkachov Date: Wed Apr 26 15:11:11 2023 +0100 aarch64: Reimplement RSHRN2 intrinsic patterns with standard RTL codes Similar to the previous patch, we can reimplement the rshrn2 patterns using standard RTL codes for shift, truncate and plus with the appropriate constants. This allows us to get rid of UNSPEC_RSHRN entirely. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ChangeLog: * config/aarch64/aarch64-simd.md (aarch64_rshrn2_insn_le): Reimplement using standard RTL codes instead of unspec. (aarch64_rshrn2_insn_be): Likewise. (aarch64_rshrn2): Adjust for the above. * config/aarch64/aarch64.md (UNSPEC_RSHRN): Delete. Diff: --- gcc/config/aarch64/aarch64-simd.md | 35 +++++++++++++++++++++++++---------- gcc/config/aarch64/aarch64.md | 1 - 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index f8913107aad..1e729542805 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -2107,23 +2107,31 @@ [(set (match_operand: 0 "register_operand" "=w") (vec_concat: (match_operand: 1 "register_operand" "0") - (unspec: [(match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_")] - UNSPEC_RSHRN)))] - "TARGET_SIMD && !BYTES_BIG_ENDIAN" - "rshrn2\\t%0., %2., %3" + (truncate: + (lshiftrt:VQN + (plus:VQN (match_operand:VQN 2 "register_operand" "w") + (match_operand:VQN 3 "aarch64_simd_rshrn_imm_vec")) + (match_operand:VQN 4 "aarch64_simd_shift_imm_vec_")))))] + "TARGET_SIMD && !BYTES_BIG_ENDIAN + && INTVAL (CONST_VECTOR_ELT (operands[3], 0)) + == (HOST_WIDE_INT_1 << (INTVAL (CONST_VECTOR_ELT (operands[4], 0)) - 1))" + "rshrn2\\t%0., %2., %4" [(set_attr "type" "neon_shift_imm_narrow_q")] ) (define_insn "aarch64_rshrn2_insn_be" [(set (match_operand: 0 "register_operand" "=w") (vec_concat: - (unspec: [(match_operand:VQN 2 "register_operand" "w") - (match_operand:VQN 3 "aarch64_simd_shift_imm_vec_")] - UNSPEC_RSHRN) + (truncate: + (lshiftrt:VQN + (plus:VQN (match_operand:VQN 2 "register_operand" "w") + (match_operand:VQN 3 "aarch64_simd_rshrn_imm_vec")) + (match_operand:VQN 4 "aarch64_simd_shift_imm_vec_"))) (match_operand: 1 "register_operand" "0")))] - "TARGET_SIMD && BYTES_BIG_ENDIAN" - "rshrn2\\t%0., %2., %3" + "TARGET_SIMD && BYTES_BIG_ENDIAN + && INTVAL (CONST_VECTOR_ELT (operands[3], 0)) + == (HOST_WIDE_INT_1 << (INTVAL (CONST_VECTOR_ELT (operands[4], 0)) - 1))" + "rshrn2\\t%0., %2., %4" [(set_attr "type" "neon_shift_imm_narrow_q")] ) @@ -2142,17 +2150,24 @@ } else { + rtx shft + = aarch64_simd_gen_const_vector_dup (mode, + HOST_WIDE_INT_1U + << (INTVAL (operands[3]) - 1)); + operands[3] = aarch64_simd_gen_const_vector_dup (mode, INTVAL (operands[3])); if (BYTES_BIG_ENDIAN) emit_insn (gen_aarch64_rshrn2_insn_be (operands[0], operands[1], operands[2], + shft, operands[3])); else emit_insn (gen_aarch64_rshrn2_insn_le (operands[0], operands[1], operands[2], + shft, operands[3])); } DONE; diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 3e18f0405fa..e1a2b265b20 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -231,7 +231,6 @@ UNSPEC_SSP_SYSREG UNSPEC_SP_SET UNSPEC_SP_TEST - UNSPEC_RSHRN UNSPEC_RSQRT UNSPEC_RSQRTE UNSPEC_RSQRTS