* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
@ 2022-10-24 18:59 ` pinskia at gcc dot gnu.org
2024-02-15 8:21 ` jakub at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-24 18:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2022-10-24
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Expand is doing:
(insn 3 24 9 6 (set (reg/v:SI 82 [ <retval> ])
(const_int 6 [0x6])) "/app/example.cpp":4:7 -1
(nil))
(insn 9 3 14 6 (set (reg/v:SI 82 [ <retval> ])
(reg:SI 83 [ x ])) "/app/example.cpp":3:5 -1
(nil))
From this IR:
<bb 2> [local count: 1073741824]:
__asm__ goto("//" : "=r" x_2 : : : "bar" <L3>);
goto <bb 4>; [35.00%]
<bb 3> [local count: 697932184]:
<L3>:
<bb 4> [local count: 1073741824]:
# x_1 = PHI <x_2(3), 6(2)>
bar:
Note 6 does not need to be a constant here, it could be anything.
I suspect when the inline-asm goto is being expanded, it adds the assignment to
reg 82 on all edges going out of the inline-asm but then messing up because
there is some extra code due to the phi node.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
2022-10-24 18:59 ` [Bug middle-end/107385] " pinskia at gcc dot gnu.org
@ 2024-02-15 8:21 ` jakub at gcc dot gnu.org
2024-02-15 13:07 ` jakub at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-15 8:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |jakub at gcc dot gnu.org
Resolution|--- |DUPLICATE
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems to be fixed by the PR113921 fix. But more test coverage doesn't hurt, so
2024-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107385
* gcc.target/i386/pr107385.c: New test.
--- gcc/testsuite/gcc.target/i386/pr107385.c.jj 2024-01-13 00:05:00.077372302
+0100
+++ gcc/testsuite/gcc.target/i386/pr107385.c 2024-02-15 09:18:47.711260427
+0100
@@ -0,0 +1,20 @@
+/* PR middle-end/107385 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+__attribute__((noipa)) int
+foo (void)
+{
+ int x;
+ asm goto ("": "=r" (x) : "0" (15), "a" (42) :: lab);
+ x = 6;
+lab:
+ return x;
+}
+
+int
+main ()
+{
+ if (foo () != 6)
+ __builtin_abort ();
+}
*** This bug has been marked as a duplicate of bug 113921 ***
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
2022-10-24 18:59 ` [Bug middle-end/107385] " pinskia at gcc dot gnu.org
2024-02-15 8:21 ` jakub at gcc dot gnu.org
@ 2024-02-15 13:07 ` jakub at gcc dot gnu.org
2024-02-15 13:07 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-15 13:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|DUPLICATE |FIXED
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Actually, the "a" constraint isn't needed there at all and without it it can be
used on other targets. Like it fails on aarch64 without the patch the same.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
` (2 preceding siblings ...)
2024-02-15 13:07 ` jakub at gcc dot gnu.org
@ 2024-02-15 13:07 ` jakub at gcc dot gnu.org
2024-02-15 14:56 ` cvs-commit at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-15 13:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So
2024-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107385
* gcc.dg/pr107385.c: New test.
--- gcc/testsuite/gcc.dg/pr107385.c.jj 2024-01-13 00:05:00.077372302 +0100
+++ gcc/testsuite/gcc.dg/pr107385.c 2024-02-15 09:18:47.711260427 +0100
@@ -0,0 +1,20 @@
+/* PR middle-end/107385 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+__attribute__((noipa)) int
+foo (void)
+{
+ int x;
+ asm goto ("": "=r" (x) : "0" (15) :: lab);
+ x = 6;
+lab:
+ return x;
+}
+
+int
+main ()
+{
+ if (foo () != 6)
+ __builtin_abort ();
+}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
` (3 preceding siblings ...)
2024-02-15 13:07 ` jakub at gcc dot gnu.org
@ 2024-02-15 14:56 ` cvs-commit at gcc dot gnu.org
2024-02-15 15:15 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-15 14:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:5459a9074afabf700f055fc8164f88dadb1c39b0
commit r14-9013-g5459a9074afabf700f055fc8164f88dadb1c39b0
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Feb 15 15:55:25 2024 +0100
testsuite: Add testcase for already fixed PR [PR107385]
This testcase has been fixed by the PR113921 fix, but unlike testcase
in there this one is not target specific.
2024-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107385
* gcc.dg/pr107385.c: New test.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
` (4 preceding siblings ...)
2024-02-15 14:56 ` cvs-commit at gcc dot gnu.org
@ 2024-02-15 15:15 ` cvs-commit at gcc dot gnu.org
2024-02-15 15:17 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-15 15:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:407b04b59f712ba41d1bcfbf86eba68c52e7917f
commit r13-8329-g407b04b59f712ba41d1bcfbf86eba68c52e7917f
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Feb 15 15:55:25 2024 +0100
testsuite: Add testcase for already fixed PR [PR107385]
This testcase has been fixed by the PR113921 fix, but unlike testcase
in there this one is not target specific.
2024-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107385
* gcc.dg/pr107385.c: New test.
(cherry picked from commit 5459a9074afabf700f055fc8164f88dadb1c39b0)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
` (5 preceding siblings ...)
2024-02-15 15:15 ` cvs-commit at gcc dot gnu.org
@ 2024-02-15 15:17 ` cvs-commit at gcc dot gnu.org
2024-02-15 15:21 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-15 15:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:d2ebd5948bd21f54fdbc5ea99e391be59d0af64c
commit r12-10159-gd2ebd5948bd21f54fdbc5ea99e391be59d0af64c
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Feb 15 15:55:25 2024 +0100
testsuite: Add testcase for already fixed PR [PR107385]
This testcase has been fixed by the PR113921 fix, but unlike testcase
in there this one is not target specific.
2024-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107385
* gcc.dg/pr107385.c: New test.
(cherry picked from commit 5459a9074afabf700f055fc8164f88dadb1c39b0)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
` (6 preceding siblings ...)
2024-02-15 15:17 ` cvs-commit at gcc dot gnu.org
@ 2024-02-15 15:21 ` cvs-commit at gcc dot gnu.org
2024-02-15 19:06 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-15 15:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:a6005ed41111f1200ce59501cfadd2d8f558ad90
commit r11-11240-ga6005ed41111f1200ce59501cfadd2d8f558ad90
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Feb 15 15:55:25 2024 +0100
testsuite: Add testcase for already fixed PR [PR107385]
This testcase has been fixed by the PR113921 fix, but unlike testcase
in there this one is not target specific.
2024-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107385
* gcc.dg/pr107385.c: New test.
(cherry picked from commit 5459a9074afabf700f055fc8164f88dadb1c39b0)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
` (7 preceding siblings ...)
2024-02-15 15:21 ` cvs-commit at gcc dot gnu.org
@ 2024-02-15 19:06 ` cvs-commit at gcc dot gnu.org
2024-02-15 19:08 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-15 19:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:0d5d1c75f5c68b6064640c3154ae5f4c0b464905
commit r14-9017-g0d5d1c75f5c68b6064640c3154ae5f4c0b464905
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Feb 15 20:04:01 2024 +0100
testsuite: Require lra effective target for pr107385.c
Old reload doesn't support asm goto with output operands.
We have lra effective target (though, strangely it returns
0 just for 2 targets out of at least 16 targets with no LRA support),
so this patch uses it, similarly how it is done in other asm goto
tests with output operands.
2024-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107385
* gcc.dg/pr107385.c: Require lra effective target.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
` (8 preceding siblings ...)
2024-02-15 19:06 ` cvs-commit at gcc dot gnu.org
@ 2024-02-15 19:08 ` cvs-commit at gcc dot gnu.org
2024-02-15 19:08 ` cvs-commit at gcc dot gnu.org
2024-02-15 19:09 ` cvs-commit at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-15 19:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:2354ccb493ddca6d2e1af9cc76ad45367932f1e2
commit r13-8330-g2354ccb493ddca6d2e1af9cc76ad45367932f1e2
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Feb 15 20:04:01 2024 +0100
testsuite: Require lra effective target for pr107385.c
Old reload doesn't support asm goto with output operands.
We have lra effective target (though, strangely it returns
0 just for 2 targets out of at least 16 targets with no LRA support),
so this patch uses it, similarly how it is done in other asm goto
tests with output operands.
2024-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107385
* gcc.dg/pr107385.c: Require lra effective target.
(cherry picked from commit 0d5d1c75f5c68b6064640c3154ae5f4c0b464905)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
` (9 preceding siblings ...)
2024-02-15 19:08 ` cvs-commit at gcc dot gnu.org
@ 2024-02-15 19:08 ` cvs-commit at gcc dot gnu.org
2024-02-15 19:09 ` cvs-commit at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-15 19:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:7c81fed21c355565182e00bed58375e2f3dcf01c
commit r12-10160-g7c81fed21c355565182e00bed58375e2f3dcf01c
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Feb 15 20:04:01 2024 +0100
testsuite: Require lra effective target for pr107385.c
Old reload doesn't support asm goto with output operands.
We have lra effective target (though, strangely it returns
0 just for 2 targets out of at least 16 targets with no LRA support),
so this patch uses it, similarly how it is done in other asm goto
tests with output operands.
2024-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107385
* gcc.dg/pr107385.c: Require lra effective target.
(cherry picked from commit 0d5d1c75f5c68b6064640c3154ae5f4c0b464905)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/107385] [asm goto] "=r" vs "+r" for outputs along indirect edges
2022-10-24 18:37 [Bug c/107385] New: [asm goto] "=r" vs "+r" for outputs along indirect edges ndesaulniers at google dot com
` (10 preceding siblings ...)
2024-02-15 19:08 ` cvs-commit at gcc dot gnu.org
@ 2024-02-15 19:09 ` cvs-commit at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-15 19:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107385
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:da93a3d0976ad42aa6b4f5742119f3189ea21400
commit r11-11241-gda93a3d0976ad42aa6b4f5742119f3189ea21400
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Feb 15 20:04:01 2024 +0100
testsuite: Require lra effective target for pr107385.c
Old reload doesn't support asm goto with output operands.
We have lra effective target (though, strangely it returns
0 just for 2 targets out of at least 16 targets with no LRA support),
so this patch uses it, similarly how it is done in other asm goto
tests with output operands.
2024-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107385
* gcc.dg/pr107385.c: Require lra effective target.
(cherry picked from commit 0d5d1c75f5c68b6064640c3154ae5f4c0b464905)
^ permalink raw reply [flat|nested] 13+ messages in thread