From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1816) id 8A528385701F; Mon, 24 Apr 2023 08:48:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A528385701F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682326092; bh=ZQoJuWxq/XLTHDdiviUvw02cpAeBFLMhxT6MWlkqXiw=; h=From:To:Subject:Date:From; b=I29eZhLsLvIKSgDZgfmqrW2gIdu1s9D9GuKdU7YE7TWM8ETqkEclDkvWtoY7GX+mF wP7GSD/t4UB7B/mTLV+ni8drKtZGzW2zd6u60HNahnp17V2dUNdGNDbbAOjjsx7zHs yLtO8PK5+MO/bIJEnoMXbDB9EiAWh9FoN+Sq9/t8= 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-189] [1/4] aarch64: Convert UABDL and SABDL patterns to standard RTL codes X-Act-Checkin: gcc X-Git-Author: Kyrylo Tkachov X-Git-Refname: refs/heads/master X-Git-Oldrev: 6ec565d8755afe1c187cda69fb8e478e669cfd02 X-Git-Newrev: c60654918bc14c3d8fe04d3e7c3aa9daee0a3820 Message-Id: <20230424084812.8A528385701F@sourceware.org> Date: Mon, 24 Apr 2023 08:48:12 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c60654918bc14c3d8fe04d3e7c3aa9daee0a3820 commit r14-189-gc60654918bc14c3d8fe04d3e7c3aa9daee0a3820 Author: Kyrylo Tkachov Date: Mon Apr 24 09:41:42 2023 +0100 [1/4] aarch64: Convert UABDL and SABDL patterns to standard RTL codes This is the first patch in a series to improve the RTL representation of the sum-of-absolute-differences patterns in the backend. We can use standard RTL codes and remove some unspecs. For UABDL and SABDL we have a widening of the result so we can represent uabdl (x, y) as (zero_extend (minus (smax (x, y) (smin (x, y))))) and sabdl (x, y) as (zero_extend (minus (umax (x, y) (umin (x, y))))). It is important to use zero_extend rather than sign_extend for the sabdl case, as the result of the absolute difference is still a positive unsigned value (the signedness of the operation refers to the values being diffed, not the absolute value of the difference) that must be zero-extended. Bootstrapped and tested on aarch64-none-linux-gnu (these intrinsics are reasonably well-covered by the advsimd-intrinsics.exp tests) gcc/ChangeLog: * config/aarch64/aarch64-simd.md (aarch64_abdl): Rename to... (aarch64_abdl): ... This. Use standard RTL ops instead of unspec. * config/aarch64/aarch64.md (UNSPEC_SABDL, UNSPEC_UABDL): Delete. * config/aarch64/iterators.md (ABDL): Delete. (sur): Remove handling of UNSPEC_SABDL and UNSPEC_UABDL. Diff: --- gcc/config/aarch64/aarch64-simd.md | 16 ++++++++++------ gcc/config/aarch64/aarch64.md | 2 -- gcc/config/aarch64/iterators.md | 4 ---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index d1e74a6704a..b46eb1d3149 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -899,14 +899,18 @@ [(set_attr "type" "neon_abd")] ) - -(define_insn "aarch64_abdl" +(define_insn "aarch64_abdl" [(set (match_operand: 0 "register_operand" "=w") - (unspec: [(match_operand:VD_BHSI 1 "register_operand" "w") - (match_operand:VD_BHSI 2 "register_operand" "w")] - ABDL))] + (zero_extend: + (minus:VD_BHSI + (USMAX:VD_BHSI + (match_operand:VD_BHSI 1 "register_operand" "w") + (match_operand:VD_BHSI 2 "register_operand" "w")) + (:VD_BHSI + (match_dup 1) + (match_dup 2)))))] "TARGET_SIMD" - "abdl\t%0., %1., %2." + "abdl\t%0., %1., %2." [(set_attr "type" "neon_abd")] ) diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index eaa87bf0276..a1f35f26318 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -206,7 +206,6 @@ UNSPEC_RBIT UNSPEC_SABAL UNSPEC_SABAL2 - UNSPEC_SABDL UNSPEC_SABDL2 UNSPEC_SADALP UNSPEC_SCVTF @@ -230,7 +229,6 @@ UNSPEC_TLSLE48 UNSPEC_UABAL UNSPEC_UABAL2 - UNSPEC_UABDL UNSPEC_UABDL2 UNSPEC_UADALP UNSPEC_UCVTF diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index d0184c84a0b..b7d67a64ca1 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -2570,9 +2570,6 @@ ;; The unspec codes for the SABAL, UABAL AdvancedSIMD instructions. (define_int_iterator ABAL [UNSPEC_SABAL UNSPEC_UABAL]) -;; The unspec codes for the SABDL, UABDL AdvancedSIMD instructions. -(define_int_iterator ABDL [UNSPEC_SABDL UNSPEC_UABDL]) - ;; The unspec codes for the SABAL2, UABAL2 AdvancedSIMD instructions. (define_int_iterator ABAL2 [UNSPEC_SABAL2 UNSPEC_UABAL2]) @@ -3362,7 +3359,6 @@ (UNSPEC_ADDHN "") (UNSPEC_RADDHN "r") (UNSPEC_SABAL "s") (UNSPEC_UABAL "u") (UNSPEC_SABAL2 "s") (UNSPEC_UABAL2 "u") - (UNSPEC_SABDL "s") (UNSPEC_UABDL "u") (UNSPEC_SABDL2 "s") (UNSPEC_UABDL2 "u") (UNSPEC_SADALP "s") (UNSPEC_UADALP "u") (UNSPEC_SUBHN "") (UNSPEC_RSUBHN "r")