[Bug target/126411] RISC-V rv64gcv: wrong code at -O0 with simple shuffle

"raphael.zinsly at oss dot qualcomm.com via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126411

Raphael M Zinsly <raphael.zinsly at oss dot qualcomm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |raphael.zinsly at oss dot qualcomm
                   |                            |.com

--- Comment #3 from Raphael M Zinsly <raphael.zinsly at oss dot qualcomm.com> ---
(In reply to Souradipto Das from comment #2)
> Created attachment 65147 [details]
> [PATCH] RISC-V: Reject non-monotonic shuffle masks in slide patterns
> 
> Hi, I added checks so that intermediate elements conform to the expected
> monotonic slide segments. I wasn't able to get a clean make check run
> locally due to DejaGNU board-file configuration issues on my end (unrelated
> to the patch itself) but i was able to verify that the patch holds its
> effectiveness on this bug

This seems to work but I think you could do that without the loop as we already
look for a monotonic sequence later, you could explicitly check if the
beginning and end of the sequence corresponds to OP0 and OP1 respectively (vlen
- slideup_cnt and 2 * vlen - 1 - slideup_cnt). The current code assumes that
but this is not guaranteed as this testcased caught. This could be checked in
the same place as we look at the slideup_cnt positions.
If you go this route you should also check for only one pivot by adding
need_slideup_p in the second pivot check to be safe.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.