public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106063] [13 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:281 with -O2 -fno-tree-forwprop --param=evrp-mode=legacy-first
Date: Fri, 24 Jun 2022 10:29:17 +0000	[thread overview]
Message-ID: <bug-106063-4-2SWWvTRU7O@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106063-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |tnfchris at gcc dot gnu.org
   Last reconfirmed|                            |2022-06-24

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Interestingly

typedef __int128 __attribute__((__vector_size__ (16))) V;
typedef unsigned __int128 __attribute__((__vector_size__ (16))) uV;
typedef V bV __attribute__((vector_mask));
V __GIMPLE (ssa,startwith("isel"))
foo (V v)
{
  uV _1;
  bV _2;
  V _4;

  __BB(2,guessed_local(1073741824)):
  _1 = __VIEW_CONVERT <uV>(v_3(D));
  _2 = _1 <= _Literal (uV) { _Literal (unsigned __int128) 15 };
  _4 = _2 ? _Literal (V) { _Literal (__int128) -1 } : _Literal (V) { 0 };
  return _4;

}

works, even with -fdisable-tree-veclower21

The issue is that we cannot expand the unsigned comparsion _2 = _1 <= { 15 };
which is introduced in VRP2 from the equality compare:

--- t2.c.197t.threadfull2       2022-06-24 12:25:08.204648605 +0200
+++ t2.c.198t.vrp2      2022-06-24 12:25:08.204648605 +0200
@@ -10,13 +10,15 @@
 ;; 2 succs { 1 }
 V foo (V v)
 {
+  vector(1) uint128_t _1;
   vector(1) <signed-boolean:128> _2;
   V _4;
   vector(1) __int128 _6;

   <bb 2> [local count: 1073741824]:
   _6 = v_3(D) & { -16 };
-  _2 = _6 == { 0 };
+  _1 = VIEW_CONVERT_EXPR<vector(1) uint128_t>(v_3(D));
+  _2 = _1 <= { 15 };
   _4 = VEC_COND_EXPR <_2, { -1 }, { 0 }>;
   return _4;

but after vector lowering only vector operations that are handled by the
target may be introduced.  The pattern

/* Transform comparisons of the form (X & Y) CMP 0 to X CMP2 Z
   where ~Y + 1 == pow2 and Z = ~Y.  */
(for cst (VECTOR_CST INTEGER_CST)
 (for cmp (eq ne)
      icmp (le gt)
  (simplify
   (cmp (bit_and:c@2 @0 cst@1) integer_zerop)
    (with { tree csts = bitmask_inv_cst_vector_p (@1); }
     (if (csts && (VECTOR_TYPE_P (TREE_TYPE (@1)) || single_use (@2)))
      (if (TYPE_UNSIGNED (TREE_TYPE (@1)))
       (icmp @0 { csts; })
       (with { tree utype = unsigned_type_for (TREE_TYPE (@1)); }
         (icmp (view_convert:utype @0) { csts; }))))))))

fails to check that in the vector case.  Caused by r12-5650-g29df53fe349073
(thus latent on the branch).

  parent reply	other threads:[~2022-06-24 10:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23  6:46 [Bug tree-optimization/106063] New: " zsojka at seznam dot cz
2022-06-23 14:22 ` [Bug tree-optimization/106063] " amacleod at redhat dot com
2022-06-24 10:29 ` rguenth at gcc dot gnu.org [this message]
2022-06-24 10:29 ` [Bug tree-optimization/106063] [12/13 " rguenth at gcc dot gnu.org
2022-06-24 11:33 ` tnfchris at gcc dot gnu.org
2022-06-26 22:10 ` tnfchris at gcc dot gnu.org
2022-07-08  7:31 ` cvs-commit at gcc dot gnu.org
2022-07-10  8:41 ` [Bug tree-optimization/106063] [12 " cvs-commit at gcc dot gnu.org
2022-07-27  9:24 ` cvs-commit at gcc dot gnu.org
2022-07-27  9:24 ` cvs-commit at gcc dot gnu.org
2022-07-27  9:25 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106063-4-2SWWvTRU7O@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).