https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78102

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #4)

> Let's see what breaks with the attached patch. The test compiles OK.

As expected, fails following test with -msse4.1:

--cut here--
typedef long long __m128i __attribute__ ((__vector_size__ (16),
__may_alias__));
typedef long long __v2di __attribute__ ((__vector_size__ (16)));

__m128i
_mm_cmpeq_epi64 (__m128i __X, __m128i __Y)
{
  return (__m128i) ((__v2di)__X == (__v2di)__Y);
}

__m128i
_mm_cmpgt_epi64 (__m128i __X, __m128i __Y)
{
  return (__m128i) ((__v2di)__X > (__v2di)__Y);
}
--cut here--

(In reply to Jakub Jelinek from comment #5)

> I'm not sure it is a good idea.  Then expand_vec_cond_expr_p will return
> true, vectorizer will use them heavily etc. and the expander will just find
> out it can't 

How about teaching these predicates to handle FAIL from the expander? Then we 
can change expanders to (e.g. vcond<VI8F_128:mode>v2di):

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index fde520f..4cd3bb2 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -11086,10 +11086,11 @@
             (match_operand:V2DI 5 "general_operand")])
          (match_operand:VI8F_128 1)
          (match_operand:VI8F_128 2)))]
-  "TARGET_SSE4_2"
+  "TARGET_SSE4_1"
 {
-  bool ok = ix86_expand_int_vcond (operands);
-  gcc_assert (ok);
+  if (!ix86_expand_int_vcond (operands))
+    FAIL;
+
   DONE;
 })

Reply via email to