[4/6] S/390: Implement noce_conversion_profitable_p.

Message ID 20181114130752.5057-5-rdapp@linux.ibm.com
State New
Headers show
Series
  • If conversion with multiple sets.
Related show

Commit Message

Robin Dapp Nov. 14, 2018, 1:07 p.m.
This patch implements noce_conversion_profitable_p by checking for the
transformation ifcvt used and only return positively if
noce_convert_multiple_sets created less than MAX_IFCVT_INSNS insns.

--

gcc/ChangeLog:

2018-11-14  Robin Dapp  <rdapp@linux.ibm.com>

	* config/s390/s390.c (MAX_IFCVT_INSNS): Define.
	(s390_noce_conversion_profitable_p): Implement.
	(TARGET_NOCE_CONVERSION_PROFITABLE_P): Define.
---
 gcc/config/s390/s390.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

-- 
2.17.0

Patch

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 0f33101d779..1018d9b8057 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -86,6 +86,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "ipa-prop.h"
 #include "ipa-fnsummary.h"
 #include "sched-int.h"
+#include "ifcvt.h"
 
 /* This file should be included last.  */
 #include "target-def.h"
@@ -393,6 +394,8 @@  struct s390_address
   bool literal_pool;
 };
 
+#define MAX_IFCVT_INSNS        2
+
 /* Few accessor macros for struct cfun->machine->s390_frame_layout.  */
 
 #define cfun_frame_layout (cfun->machine->frame_layout)
@@ -15989,6 +15992,17 @@  s390_case_values_threshold (void)
   return default_case_values_threshold ();
 }
 
+static bool
+s390_noce_conversion_profitable_p (rtx_insn *seq, struct noce_if_info *if_info)
+{
+  if (if_info->transform
+      && if_info->transform == ifcvt_transform_noce_convert_multiple_sets
+      && if_info->created_cmovs <= MAX_IFCVT_INSNS)
+    return true;
+
+  return default_noce_conversion_profitable_p (seq, if_info);
+}
+
 /* Initialize GCC target structure.  */
 
 #undef  TARGET_ASM_ALIGNED_HI_OP
@@ -16240,6 +16254,9 @@  s390_case_values_threshold (void)
 #undef TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT
 #define TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT s390_support_vector_misalignment
 
+#undef TARGET_NOCE_CONVERSION_PROFITABLE_P
+#define TARGET_NOCE_CONVERSION_PROFITABLE_P s390_noce_conversion_profitable_p
+
 #undef TARGET_VECTOR_ALIGNMENT
 #define TARGET_VECTOR_ALIGNMENT s390_vector_alignment