public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112611] New: LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664
@ 2023-11-18 20:49 xry111 at gcc dot gnu.org
  2023-11-21  2:41 ` [Bug target/112611] " xujiahao at loongson dot cn
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-11-18 20:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112611
           Summary: LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c
                    fails on LA664
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xry111 at gcc dot gnu.org
  Target Milestone: ---

Some test cases in these two files depend on some undocumented behavior of
LA464, now they fail with LA664.

I guess we should just remove the problematic test cases.

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

* [Bug target/112611] LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664
  2023-11-18 20:49 [Bug target/112611] New: LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664 xry111 at gcc dot gnu.org
@ 2023-11-21  2:41 ` xujiahao at loongson dot cn
  2023-11-21 13:15 ` xry111 at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: xujiahao at loongson dot cn @ 2023-11-21  2:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jiahao Xu <xujiahao at loongson dot cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xujiahao at loongson dot cn

--- Comment #1 from Jiahao Xu <xujiahao at loongson dot cn> ---
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.

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

* [Bug target/112611] LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664
  2023-11-18 20:49 [Bug target/112611] New: LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664 xry111 at gcc dot gnu.org
  2023-11-21  2:41 ` [Bug target/112611] " xujiahao at loongson dot cn
@ 2023-11-21 13:15 ` xry111 at gcc dot gnu.org
  2023-11-22  3:10 ` xujiahao at loongson dot cn
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-11-21 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(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.

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

* [Bug target/112611] LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664
  2023-11-18 20:49 [Bug target/112611] New: LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664 xry111 at gcc dot gnu.org
  2023-11-21  2:41 ` [Bug target/112611] " xujiahao at loongson dot cn
  2023-11-21 13:15 ` xry111 at gcc dot gnu.org
@ 2023-11-22  3:10 ` xujiahao at loongson dot cn
  2023-11-22 10:40 ` xry111 at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: xujiahao at loongson dot cn @ 2023-11-22  3:10 UTC (permalink / raw)
  To: gcc-bugs

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.

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

* [Bug target/112611] LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664
  2023-11-18 20:49 [Bug target/112611] New: LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664 xry111 at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-11-22  3:10 ` xujiahao at loongson dot cn
@ 2023-11-22 10:40 ` xry111 at gcc dot gnu.org
  2023-12-08  8:44 ` cvs-commit at gcc dot gnu.org
  2023-12-08  9:40 ` xry111 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-11-22 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Jiahao Xu from comment #3)

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

I guess it would be better to also document this issue somewhere (extend.texi
?) and recommends to just use __builtin_shuffle instead of the intrinsic
(unless the programmer knows the AND operation is not needed but the compiler
does not).

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

* [Bug target/112611] LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664
  2023-11-18 20:49 [Bug target/112611] New: LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664 xry111 at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-11-22 10:40 ` xry111 at gcc dot gnu.org
@ 2023-12-08  8:44 ` cvs-commit at gcc dot gnu.org
  2023-12-08  9:40 ` xry111 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-08  8:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by LuluCheng <chenglulu@gcc.gnu.org>:

https://gcc.gnu.org/g:40366b89e9c8e727af70ecf7007cba6c51e4b7d2

commit r14-6316-g40366b89e9c8e727af70ecf7007cba6c51e4b7d2
Author: Jiahao Xu <xujiahao@loongson.cn>
Date:   Wed Nov 29 11:16:59 2023 +0800

    LoongArch: Fix lsx-vshuf.c and lasx-xvshuf_b.c tests fail on LA664
[PR112611]

    For [x]vshuf instructions, if the index value in the selector exceeds 63,
it triggers
    undefined behavior on LA464, but not on LA664. To ensure compatibility of
these two
    tests on both LA464 and LA664, we have modified both tests to ensure that
the index
    value in the selector does not exceed 63.

    gcc/testsuite/ChangeLog:

            PR target/112611
            * gcc.target/loongarch/vector/lasx/lasx-xvshuf_b.c: Sure index less
than 64.
            * gcc.target/loongarch/vector/lsx/lsx-vshuf.c: Ditto.

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

* [Bug target/112611] LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664
  2023-11-18 20:49 [Bug target/112611] New: LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664 xry111 at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-12-08  8:44 ` cvs-commit at gcc dot gnu.org
@ 2023-12-08  9:40 ` xry111 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-08  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-12-08  9:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-18 20:49 [Bug target/112611] New: LoongArch: Test cases lsx-vshuf.c and lasx-xvshuf_b.c fails on LA664 xry111 at gcc dot gnu.org
2023-11-21  2:41 ` [Bug target/112611] " xujiahao at loongson dot cn
2023-11-21 13:15 ` xry111 at gcc dot gnu.org
2023-11-22  3:10 ` xujiahao at loongson dot cn
2023-11-22 10:40 ` xry111 at gcc dot gnu.org
2023-12-08  8:44 ` cvs-commit at gcc dot gnu.org
2023-12-08  9:40 ` xry111 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).