aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-07-10 13:30:30 +0200
committerRichard Biener <rguenther@suse.de>2025-07-11 10:41:57 +0200
commit363b29a9cfbb470d6987fb395035c56bae30c64b (patch)
tree3edfe6e4d846917f3ffa27061426f08ac9c321b3 /gcc
parent3e7dd06860bf0589bc743e458b16bd1d33d73835 (diff)
downloadgcc-363b29a9cfbb470d6987fb395035c56bae30c64b.zip
gcc-363b29a9cfbb470d6987fb395035c56bae30c64b.tar.gz
gcc-363b29a9cfbb470d6987fb395035c56bae30c64b.tar.bz2
properly compute fp/mode for scalar ops for vectorizer costing
The x86 add_stmt_hook relies on the passed vectype to determine the mode and whether it is FP for a scalar operation. This is unreliable now for stmts involving patterns and in the future when there is no vector type passed for scalar operations. To be least disruptive I've kept using the vector type if it is passed. * config/i386/i386.cc (ix86_vector_costs::add_stmt_cost): Use the LHS of a scalar stmt to determine mode and whether it is FP.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/i386/i386.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index ad7360e..313522b 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -25798,6 +25798,14 @@ ix86_vector_costs::add_stmt_cost (int count, vect_cost_for_stmt kind,
if (scalar_p)
mode = TYPE_MODE (TREE_TYPE (vectype));
}
+ /* When we are costing a scalar stmt use the scalar stmt to get at the
+ type of the operation. */
+ else if (scalar_p && stmt_info)
+ if (tree lhs = gimple_get_lhs (stmt_info->stmt))
+ {
+ fp = FLOAT_TYPE_P (TREE_TYPE (lhs));
+ mode = TYPE_MODE (TREE_TYPE (lhs));
+ }
if ((kind == vector_stmt || kind == scalar_stmt)
&& stmt_info