summaryrefslogtreecommitdiff
path: root/gcc/config/s390
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2016-12-02 08:25:27 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2016-12-02 08:25:27 +0000
commit292e369f7394336a2fc35f39c2823eb3df6c4360 (patch)
tree0622db93e3d416b514fe9512047a44cc2859f782 /gcc/config/s390
parentc4a77d65543a2bb87dd9d1bfa7da5b8c0640b8bb (diff)
downloadgcc-292e369f7394336a2fc35f39c2823eb3df6c4360.tar.gz
S/390: Define vectorization_cost hook
Define the vectorization_cost hook. The only change right now compared to the default implementation is the reduced costs for unaligned loads/stores. This is supposed to prevent unnecessary loop peeling performed to reach better alignments. Further tuning of this hook is required. -Andreas- gcc/ChangeLog: 2016-12-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * gcc/config/s390/s390.c (s390_builtin_vectorization_cost): New function. (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): Define target macro. gcc/testsuite/ChangeLog: 2016-12-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * gcc.target/s390/vector/vec-nopeel-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243158 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/s390')
-rw-r--r--gcc/config/s390/s390.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index dab4f43e37a..767666e3f7b 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -3674,6 +3674,40 @@ s390_address_cost (rtx addr, machine_mode mode ATTRIBUTE_UNUSED,
return ad.indx? COSTS_N_INSNS (1) + 1 : COSTS_N_INSNS (1);
}
+/* Implement targetm.vectorize.builtin_vectorization_cost. */
+static int
+s390_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
+ tree vectype,
+ int misalign ATTRIBUTE_UNUSED)
+{
+ switch (type_of_cost)
+ {
+ case scalar_stmt:
+ case scalar_load:
+ case scalar_store:
+ case vector_stmt:
+ case vector_load:
+ case vector_store:
+ case vec_to_scalar:
+ case scalar_to_vec:
+ case cond_branch_not_taken:
+ case vec_perm:
+ case vec_promote_demote:
+ case unaligned_load:
+ case unaligned_store:
+ return 1;
+
+ case cond_branch_taken:
+ return 3;
+
+ case vec_construct:
+ return TYPE_VECTOR_SUBPARTS (vectype) - 1;
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
/* If OP is a SYMBOL_REF of a thread-local symbol, return its TLS mode,
otherwise return 0. */
@@ -15428,6 +15462,9 @@ s390_excess_precision (enum excess_precision_type type)
#define TARGET_REGISTER_MOVE_COST s390_register_move_cost
#undef TARGET_MEMORY_MOVE_COST
#define TARGET_MEMORY_MOVE_COST s390_memory_move_cost
+#undef TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
+#define TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST \
+ s390_builtin_vectorization_cost
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG s390_reorg