public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5207] aarch64: Get floatness from stmt_info
@ 2021-11-12 17:34 Richard Sandiford
  0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2021-11-12 17:34 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:902b7c9e1835bc11a6127f9bd0c18928bfdbf18d

commit r12-5207-g902b7c9e1835bc11a6127f9bd0c18928bfdbf18d
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Fri Nov 12 17:33:01 2021 +0000

    aarch64: Get floatness from stmt_info
    
    This patch gets the floatness of a memory access from the data
    reference rather than the vectype.  This makes it more suitable
    for use in scalar costing code.
    
    gcc/
            * config/aarch64/aarch64.c (aarch64_dr_type): New function.
            (aarch64_vector_costs::count_ops): Use it rather than the
            vectype to determine floatness.

Diff:
---
 gcc/config/aarch64/aarch64.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 416362beefd..d8bbc66c226 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -14920,6 +14920,16 @@ aarch64_simd_vec_costs_for_flags (unsigned int flags)
   return costs->advsimd;
 }
 
+/* If STMT_INFO is a memory reference, return the scalar memory type,
+   otherwise return null.  */
+static tree
+aarch64_dr_type (stmt_vec_info stmt_info)
+{
+  if (auto dr = STMT_VINFO_DATA_REF (stmt_info))
+    return TREE_TYPE (DR_REF (dr));
+  return NULL_TREE;
+}
+
 /* Decide whether to use the unrolling heuristic described above
    m_unrolled_advsimd_niters, updating that field if so.  LOOP_VINFO
    describes the loop that we're vectorizing.  */
@@ -15649,7 +15659,7 @@ aarch64_vector_costs::count_ops (unsigned int count, vect_cost_for_stmt kind,
 	    prev_count = num_copies;
 	}
       ops->loads += num_copies;
-      if (vec_flags || FLOAT_TYPE_P (vectype))
+      if (vec_flags || FLOAT_TYPE_P (aarch64_dr_type (stmt_info)))
 	ops->general_ops += base_issue->fp_simd_load_general_ops * num_copies;
       break;
 
@@ -15657,7 +15667,7 @@ aarch64_vector_costs::count_ops (unsigned int count, vect_cost_for_stmt kind,
     case unaligned_store:
     case scalar_store:
       ops->stores += num_copies;
-      if (vec_flags || FLOAT_TYPE_P (vectype))
+      if (vec_flags || FLOAT_TYPE_P (aarch64_dr_type (stmt_info)))
 	ops->general_ops += base_issue->fp_simd_store_general_ops * num_copies;
       break;
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-12 17:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 17:34 [gcc r12-5207] aarch64: Get floatness from stmt_info Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).