]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: convert widen_[us]sum into convert optab [PR122069]
authorTamar Christina <tamar.christina@arm.com>
Sat, 18 Oct 2025 07:20:47 +0000 (08:20 +0100)
committerTamar Christina <tamar.christina@arm.com>
Sat, 18 Oct 2025 07:24:17 +0000 (08:24 +0100)
This patch is a mechanical rewrite of the widen_[us]sum optabs from a direct to
a conversion optab.  The result of which requires the output mode to be added to
the existing patterns.

No change in functionality is expected.

gcc/ChangeLog:

PR middle-end/122069
* config/arm/iterators.md (v_double_width): New, matching
V_double_width.
* config/arm/neon.md (widen_ssum<mode>3): Renamed ...
(widen_ssum<v_double_width><mode>3, widen_ssum<V_widen_l><mode>3): ...
into these.
(widen_usum<mode>3): Renamed ...
(widen_usum<v_double_width><mode>3, widen_usum<V_widen_l><mode>3): ...
into these.

gcc/config/arm/iterators.md
gcc/config/arm/neon.md

index eb519e7b5f8c845b64749e37fdb87bff37cd04bf..dfbe0270c8d7e2a826cfd9406c5d4f32d6b8b90b 100644 (file)
                   (V4HI "V2SI") (V8HI "V4SI")
                   (V2SI "DI")   (V4SI "V2DI")])
 
+;; Modes with double-width elements.
+(define_mode_attr v_double_width [(V8QI "v4hi") (V16QI "v8hi")
+                                 (V4HI "v2si") (V8HI "v4si")
+                                 (V2SI "di")   (V4SI "v2di")])
+
 ;; Double-sized modes with the same element size.
 ;; Used for neon_vdup_lane, where the second operand is double-sized
 ;; even when the first one is quad.
index c887e7fcdff3d2131fe60dd0801b004b46885f3c..4ca15273088894dcc438f054691231a98e5f863b 100644 (file)
 
 ;; Widening operations
 
-(define_expand "widen_ssum<mode>3"
+(define_expand "widen_ssum<v_double_width><mode>3"
   [(set (match_operand:<V_double_width> 0 "s_register_operand")
        (plus:<V_double_width>
         (sign_extend:<V_double_width>
 }
   [(set_attr "type" "neon_add_widen")])
 
-(define_insn "widen_ssum<mode>3"
+(define_insn "widen_ssum<V_widen_l><mode>3"
   [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
        (plus:<V_widen>
         (sign_extend:<V_widen>
   [(set_attr "type" "neon_add_widen")]
 )
 
-(define_expand "widen_usum<mode>3"
+(define_expand "widen_usum<v_double_width><mode>3"
   [(set (match_operand:<V_double_width> 0 "s_register_operand")
        (plus:<V_double_width>
         (zero_extend:<V_double_width>
 }
   [(set_attr "type" "neon_add_widen")])
 
-(define_insn "widen_usum<mode>3"
+(define_insn "widen_usum<V_widen_l><mode>3"
   [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
        (plus:<V_widen> (zero_extend:<V_widen>
                          (match_operand:VW 1 "s_register_operand" "%w"))