From 7793947247f37abc36dd53a7d63e46499ca6b054 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Sat, 18 Oct 2025 08:20:47 +0100 Subject: [PATCH] arm: convert widen_[us]sum into convert optab [PR122069] 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_ssum3): Renamed ... (widen_ssum3, widen_ssum3): ... into these. (widen_usum3): Renamed ... (widen_usum3, widen_usum3): ... into these. --- gcc/config/arm/iterators.md | 5 +++++ gcc/config/arm/neon.md | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md index eb519e7b5f8c..dfbe0270c8d7 100644 --- a/gcc/config/arm/iterators.md +++ b/gcc/config/arm/iterators.md @@ -1788,6 +1788,11 @@ (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. diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index c887e7fcdff3..4ca152730888 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -981,7 +981,7 @@ ;; Widening operations -(define_expand "widen_ssum3" +(define_expand "widen_ssum3" [(set (match_operand: 0 "s_register_operand") (plus: (sign_extend: @@ -1040,7 +1040,7 @@ } [(set_attr "type" "neon_add_widen")]) -(define_insn "widen_ssum3" +(define_insn "widen_ssum3" [(set (match_operand: 0 "s_register_operand" "=w") (plus: (sign_extend: @@ -1051,7 +1051,7 @@ [(set_attr "type" "neon_add_widen")] ) -(define_expand "widen_usum3" +(define_expand "widen_usum3" [(set (match_operand: 0 "s_register_operand") (plus: (zero_extend: @@ -1110,7 +1110,7 @@ } [(set_attr "type" "neon_add_widen")]) -(define_insn "widen_usum3" +(define_insn "widen_usum3" [(set (match_operand: 0 "s_register_operand" "=w") (plus: (zero_extend: (match_operand:VW 1 "s_register_operand" "%w"))