diff mbox series

[3/8] S/390: Implement vcond_supported_p hook

Message ID 20190820091845.80750-4-iii@linux.ibm.com
State New
Headers show
Series Use signaling FP comparison instructions | expand

Commit Message

Ilya Leoshkevich Aug. 20, 2019, 9:18 a.m. UTC
z13 supports only non-signaling vector comparisons.  This means we
cannot vectorize LT, LE, GT, GE and LTGT when compiling for z13.  Notify
middle-end about this using vcond_supported_p hook.

gcc/ChangeLog:

2019-08-09  Ilya Leoshkevich  <iii@linux.ibm.com>

	* config/s390/s390.c (s390_vcond_supported_p): Implement
	vcond_supported_p.
	(TARGET_VCOND_SUPPORTED_P): Likewise.
---
 gcc/config/s390/s390.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
diff mbox series

Patch

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index fa17d7d5d08..675360f5a71 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -16030,6 +16030,27 @@  s390_vector_alignment (const_tree type)
   return MIN (64, tree_to_shwi (TYPE_SIZE (type)));
 }
 
+/* Return true if vcond$a$b expander supports given vector comparison.  */
+
+static bool
+s390_vcond_supported_p (machine_mode, machine_mode op_mode, int code)
+{
+  if (!HONOR_NANS (op_mode))
+    return true;
+  switch (code)
+    {
+    case LE_EXPR:
+    case LT_EXPR:
+    case GE_EXPR:
+    case GT_EXPR:
+    case LTGT_EXPR:
+      /* Signaling vector comparisons are supported only on z14+.  */
+      return TARGET_Z14;
+    default:
+      return true;
+    }
+}
+
 /* Implement TARGET_CONSTANT_ALIGNMENT.  Alignment on even addresses for
    LARL instruction.  */
 
@@ -16660,6 +16681,9 @@  s390_shift_truncation_mask (machine_mode mode)
 #undef TARGET_VECTOR_ALIGNMENT
 #define TARGET_VECTOR_ALIGNMENT s390_vector_alignment
 
+#undef TARGET_VCOND_SUPPORTED_P
+#define TARGET_VCOND_SUPPORTED_P s390_vcond_supported_p
+
 #undef TARGET_INVALID_BINARY_OP
 #define TARGET_INVALID_BINARY_OP s390_invalid_binary_op