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

--- Comment #3 from Jiahao Xu <xujiahao at loongson dot cn> ---
(In reply to Xi Ruoyao from comment #2)
> (In reply to Jiahao Xu from comment #1)
> > Due to some issues with the implementation of the [x]vshuf instruction in
> > LA464, there is a problem where, when the index value in the register is
> > greater than or equal to 64, it fails to perform modulo operation to obtain
> > a new index for selecting the corresponding element. Instead, it directly
> > writes a 0 to the destination register. LA664 has fixed this issue.
> > 
> > The expected results in these two files are not the correct results, but
> > rather the results obtained directly using the [x]vshuf instruction on
> > la464. This is why they fail on LA664. Now, there are two possible
> > solutions. One is to delete these two problematic test cases, as you
> > suggested. The other solution is to modify the expected results to the
> > correct ones and only test these two files on LA664. We are currently
> > considering which option to choose.
> 
> Maybe just rewriting the results to match LA664, and invoke CPUCFG to skip
> these tests for any other implementations?
> 
> In the future we better assign a CPUCFG bit to indicate this.

We now consider it as undefined behavior rather than a bug for [x]vshuf
instructions. In vec_perm pattern, we use vector logical AND instructions to
perform modulo operations in order to correctly use the [x]vshuf instructions.
Therefore, we have decided to rewrite the two tests and ensure that the index
values in the selector do not exceed 64.

Reply via email to