https://gcc.gnu.org/g:bfa44e604d63ebb90dd2ef645820c4db44cdfd7c

commit r15-3964-gbfa44e604d63ebb90dd2ef645820c4db44cdfd7c
Author: Victor Do Nascimento <victor.donascime...@arm.com>
Date:   Wed Jun 5 11:11:06 2024 +0100

    arm: Fix arm backend-use of (u|s|us)dot_prod patterns
    
    Given recent changes to the dot_prod standard pattern name, this patch
    fixes the arm back-end by implementing the following changes:
    
    1. Add 2nd mode to all patterns relating to the dot-product in .md
    files.
    2. redirect the single-mode CODE_FOR_neon_(u|s|us)dot<mode> values
    generated from `arm_neon_builtins.def' to their new 2-mode
    equivalents via means of simple aliases, as per the following example:
    
      constexpr insn_code CODE_FOR_neon_sdotv8qi
        = CODE_FOR_neon_sdotv2siv8qi;
    
    gcc/ChangeLog:
    
            * config/arm/neon.md (<sup>dot_prod<vsi2qi>): Renamed to...
            (<sup>dot_prod<mode><vsi2qi>): ...this.
            (neon_<sup>dot<vsi2qi>): Renamed to...
            (neon_<sup>dot<mode><vsi2qi>): ...this.
            (neon_usdot<vsi2qi>): Renamed to...
            (neon_usdot<mode><vsi2qi>): ...this.
            (usdot_prod<vsi2qi>): Renamed to...
            (usdot_prod<mode><vsi2qi>): ...this.
            * config/arm/arm-builtins.cc
            (CODE_FOR_neon_sdotv8qi): Definie as alias to
            new CODE_FOR_neon_sdotv2siv8qi.
            (CODE_FOR_neon_udotv8qi): Definie as alias to
            new CODE_FOR_neon_udotv2siv8qi.
            (CODE_FOR_neon_usdotv8qi): Definie as alias to
            new CODE_FOR_neon_usdotv2siv8qi.
            (CODE_FOR_neon_sdotv16qi): Definie as alias to
            new CODE_FOR_neon_sdotv4siv16qi.
            (CODE_FOR_neon_udotv16qi): Definie as alias to
            new CODE_FOR_neon_udotv4siv16qi.
            (CODE_FOR_neon_usdotv16qi): Definie as alias to
            new CODE_FOR_neon_usdotv4siv16qi.

Diff:
---
 gcc/config/arm/arm-builtins.cc | 7 +++++++
 gcc/config/arm/neon.md         | 8 ++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc
index c9d50bf8fbb1..74cea8900b48 100644
--- a/gcc/config/arm/arm-builtins.cc
+++ b/gcc/config/arm/arm-builtins.cc
@@ -908,6 +908,13 @@ typedef struct {
   enum arm_type_qualifiers *qualifiers;
 } arm_builtin_datum;
 
+constexpr insn_code CODE_FOR_neon_sdotv8qi = CODE_FOR_neon_sdotv2siv8qi;
+constexpr insn_code CODE_FOR_neon_udotv8qi = CODE_FOR_neon_udotv2siv8qi;
+constexpr insn_code CODE_FOR_neon_usdotv8qi = CODE_FOR_neon_usdotv2siv8qi;
+constexpr insn_code CODE_FOR_neon_sdotv16qi = CODE_FOR_neon_sdotv4siv16qi;
+constexpr insn_code CODE_FOR_neon_udotv16qi = CODE_FOR_neon_udotv4siv16qi;
+constexpr insn_code CODE_FOR_neon_usdotv16qi = CODE_FOR_neon_usdotv4siv16qi;
+
 #define CF(N,X) CODE_FOR_neon_##N##X
 
 #define VAR1(T, N, A) \
diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
index fa4a7aeda357..6892b7b0f44a 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -2989,7 +2989,7 @@
 ;; ...
 ;;
 ;; and so the vectorizer provides r, in which the result has to be accumulated.
-(define_insn "<sup>dot_prod<vsi2qi>"
+(define_insn "<sup>dot_prod<mode><vsi2qi>"
   [(set (match_operand:VCVTI 0 "register_operand" "=w")
        (plus:VCVTI
          (unspec:VCVTI [(match_operand:<VSI2QI> 1 "register_operand" "w")
@@ -3002,7 +3002,7 @@
 )
 
 ;; These instructions map to the __builtins for the Dot Product operations
-(define_expand "neon_<sup>dot<vsi2qi>"
+(define_expand "neon_<sup>dot<mode><vsi2qi>"
   [(set (match_operand:VCVTI 0 "register_operand" "=w")
        (plus:VCVTI
          (unspec:VCVTI [(match_operand:<VSI2QI> 2 "register_operand")
@@ -3013,7 +3013,7 @@
 )
 
 ;; These instructions map to the __builtins for the Dot Product operations.
-(define_insn "neon_usdot<vsi2qi>"
+(define_insn "neon_usdot<mode><vsi2qi>"
   [(set (match_operand:VCVTI 0 "register_operand" "=w")
        (plus:VCVTI
          (unspec:VCVTI
@@ -3112,7 +3112,7 @@
 )
 
 ;; Auto-vectorizer pattern for usdot
-(define_expand "usdot_prod<vsi2qi>"
+(define_expand "usdot_prod<mode><vsi2qi>"
   [(set (match_operand:VCVTI 0 "register_operand")
        (plus:VCVTI (unspec:VCVTI [(match_operand:<VSI2QI> 1
                                                        "register_operand")

Reply via email to