]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix VCOND expansion
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 21 Oct 2022 13:46:37 +0000 (15:46 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 21 Oct 2022 14:09:55 +0000 (16:09 +0200)
Instead of only allowing the signed optab to provide EQ/NE compares, we
allow both here since there seems to be no documented canonicalization.

gcc/
PR target/107336
* optabs.c (expand_vec_cond_expr): Query both VCOND and VCONDU for
EQ and NE.

gcc/optabs.c

index 64f23d2c293725375e0eabae6fcc42cd3d3fd27a..93f99423727d02d5bc325fd356bbce57da79da29 100644 (file)
@@ -5902,6 +5902,14 @@ expand_vec_cond_expr (tree vec_cond_type, tree op0, tree op1, tree op2,
                           GET_MODE_NUNITS (cmp_op_mode)));
 
   icode = get_vcond_icode (mode, cmp_op_mode, unsignedp);
+  /* Some targets do not have vcondeq and only vcond with NE/EQ
+     but not vcondu, so make sure to also try vcond here as
+     vcond_icode_p would canonicalize the optab query to.  */
+  if (icode == CODE_FOR_nothing
+      && (tcode == NE_EXPR || tcode == EQ_EXPR)
+      && ((icode = get_vcond_icode (mode, cmp_op_mode, !unsignedp))
+         != CODE_FOR_nothing))
+    unsignedp = !unsignedp;
   if (icode == CODE_FOR_nothing)
     {
       if (tcode == LT_EXPR