public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112999] New: riscv: Infinite loop with mask extraction
@ 2023-12-13 12:29 rdapp at gcc dot gnu.org
  2023-12-13 12:32 ` [Bug target/112999] " rdapp at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rdapp at gcc dot gnu.org @ 2023-12-13 12:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112999
           Summary: riscv: Infinite loop with mask extraction
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rdapp at gcc dot gnu.org
                CC: juzhe.zhong at rivai dot ai, pan2.li at intel dot com
  Target Milestone: ---
            Target: riscv

Pan Li found the following problematic case in his "full-coverage" testing and
I'm just documenting it here for reference.

/* { dg-do compile } */
/* { dg-options "-march=rv64gcv_zvl512b -mabi=lp64d
--param=riscv-autovec-lmul=m8 --param=riscv-autovec-preference=fixed-vlmax -O3
-fno-vect-cost-model -fno-tree-loop-distribute-patterns" } */

int a[1024];
int b[1024];

_Bool
fn1 ()
{
  _Bool tem;
  for (int i = 0; i < 1024; ++i)
    {
      tem = !a[i];
      b[i] = tem;
    }
  return tem;
}

We try to extract the last bit from a 128-bit value of a mask vector.  In order
to do so we first subreg by a tieable vector mode (here RVVMF4QI) then, because
we do not have a RVVMF4QI -> BI vector extraction, try type punning with a
TImode subreg.
As we do not natively support TImode, the result needs to be subreg'd again to
DImode.  In the course of doing so we get lost in subreg moves and hit an
infinite loop.  I have not tracked down the real root cause but the problem is
fixed by providing a movti pattern and special casing subreg:TI extraction from
vectors (just like we do in legitimize_move for other scalar subregs of vectors
- and wich I don't particularly like either :) ).

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-15  8:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-13 12:29 [Bug target/112999] New: riscv: Infinite loop with mask extraction rdapp at gcc dot gnu.org
2023-12-13 12:32 ` [Bug target/112999] " rdapp at gcc dot gnu.org
2023-12-13 13:47 ` juzhe.zhong at rivai dot ai
2023-12-14 16:54 ` cvs-commit at gcc dot gnu.org
2023-12-15  8:47 ` rdapp at gcc dot gnu.org

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).