]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-sra: Use MOVE_MAX for sra size limit [PR112824]
authorHongyu Wang <hongyu.wang@intel.com>
Thu, 5 Jun 2025 06:45:08 +0000 (14:45 +0800)
committerHongyu Wang <hongyu.wang@intel.com>
Thu, 5 Jun 2025 08:00:28 +0000 (16:00 +0800)
Current sra use UNITS_PER_WORD to define max scalarization size, but
for targets like x86 it allows operations on larger size, so the
components like vector variables in an aggregate can be larger than
just UNITS_PER_WORD. Use MOVE_MAX instead of UNITS_PER_WORD to allow
sra for aggregates with vector components.

gcc/ChangeLog:

PR middle-end/112824
* tree-sra.cc (sra_get_max_scalarization_size): Use MOVE_MAX
instead of UNITS_PER_WORD to define max_scalarization_size.

gcc/testsuite/ChangeLog:

* g++.target/i386/pr112824-2.C: New test.

gcc/testsuite/g++.target/i386/pr112824-2.C [new file with mode: 0644]
gcc/tree-sra.cc

diff --git a/gcc/testsuite/g++.target/i386/pr112824-2.C b/gcc/testsuite/g++.target/i386/pr112824-2.C
new file mode 100644 (file)
index 0000000..036a47b
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR target/112824 */
+/* { dg-do compile } */
+/* { dg-options "-std=c++23 -O3 -march=skylake-avx512 -mprefer-vector-width=512" } */
+/* { dg-final { scan-assembler-not "vmov.*\[ \\t\]+\[^\n\]*%rsp" } } */
+
+#include "pr112824-1.C"
+
+void prod(Dual<Dual<double,8>,2> &c, const Dual<Dual<double,8>,2> &a, const Dual<Dual<double,8>,2>&b){
+    c = a*b;
+}
index 4b6daf772841cc7a0e160162709980d9cfee4944..23236fc653774f9f141daeb0f1580fc22b89669e 100644 (file)
@@ -3760,7 +3760,7 @@ sra_get_max_scalarization_size (void)
   /* If the user didn't set PARAM_SRA_MAX_SCALARIZATION_SIZE_<...>,
      fall back to a target default.  */
   unsigned HOST_WIDE_INT max_scalarization_size
-    = get_move_ratio (optimize_speed_p) * UNITS_PER_WORD;
+    = get_move_ratio (optimize_speed_p) * MOVE_MAX;
 
   if (optimize_speed_p)
     {