public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] [PR103097] tolerate reg-stack cross-block malformed asms
@ 2021-12-08 3:14 Alexandre Oliva
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2021-12-08 3:14 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:f4126c1d6cc53399c2bd5ffe5ae09767b3eeac0f
commit f4126c1d6cc53399c2bd5ffe5ae09767b3eeac0f
Author: Alexandre Oliva <oliva@adacore.com>
Date: Sat Dec 4 03:49:32 2021 -0300
[PR103097] tolerate reg-stack cross-block malformed asms
The testcase shows malformed asms in one block confuse reg-stack logic
in another block. Moving the resetting of any_malformed_asm to the
end of the pass enables it to take effect throughout the affected
function.
for gcc/ChangeLog
PR target/103097
* reg-stack.c (convert_regs_1): Move any_malformed_asm
resetting...
(reg_to_stack): ... here.
for gcc/testsuite/ChangeLog
PR target/103097
* gcc.target/i386/pr103097.c: New.
Diff:
---
gcc/reg-stack.c | 3 +--
gcc/testsuite/gcc.target/i386/pr103097.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 1d9ea035cf4..a83ee253777 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -3014,8 +3014,6 @@ convert_regs_1 (basic_block block)
bool cfg_altered = false;
int debug_insns_with_starting_stack = 0;
- any_malformed_asm = false;
-
/* Choose an initial stack layout, if one hasn't already been chosen. */
if (bi->stack_in.top == -2)
{
@@ -3385,6 +3383,7 @@ reg_to_stack (void)
0, sizeof (char) * (max_uid + 1));
convert_regs ();
+ any_malformed_asm = false;
free_aux_for_blocks ();
return true;
diff --git a/gcc/testsuite/gcc.target/i386/pr103097.c b/gcc/testsuite/gcc.target/i386/pr103097.c
new file mode 100644
index 00000000000..2b7a307deec
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103097.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fharden-conditional-branches" } */
+
+/* This is a slightly simplified version of
+ gcc.target/s390/vector/long-double-asm-earlyclobber.c. On x86, the f
+ constraints in asm statements imposes some requirements that the testcase
+ doesn't meet. What's unusual is that -fharden-conditional-branches extends
+ the effects of the malformed asm onto a different basic blocks, which
+ reg-stack did not expect. */
+
+#include <assert.h>
+#include <stdint.h>
+
+void
+f (void)
+{
+ long double res, x = 0;
+ asm("" : "=f"(res) /* { dg-error "must specify a single register" } */
+ : "0"(x));
+ assert (res == x);
+}
+
+void
+g (void)
+{
+ long double res, x = 0;
+ asm("" : "=g"(res) /* this is ok. */
+ : "0"(x));
+ assert (res == x);
+}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [PR103097] tolerate reg-stack cross-block malformed asms
@ 2021-12-04 9:22 Alexandre Oliva
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2021-12-04 9:22 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:6accaabd567a66a4067afec3435bd5494659de6a
commit 6accaabd567a66a4067afec3435bd5494659de6a
Author: Alexandre Oliva <oliva@adacore.com>
Date: Sat Dec 4 03:49:32 2021 -0300
[PR103097] tolerate reg-stack cross-block malformed asms
Diff:
---
gcc/reg-stack.c | 3 +--
gcc/testsuite/gcc.target/i386/pr103097.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 1d9ea035cf4..a83ee253777 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -3014,8 +3014,6 @@ convert_regs_1 (basic_block block)
bool cfg_altered = false;
int debug_insns_with_starting_stack = 0;
- any_malformed_asm = false;
-
/* Choose an initial stack layout, if one hasn't already been chosen. */
if (bi->stack_in.top == -2)
{
@@ -3385,6 +3383,7 @@ reg_to_stack (void)
0, sizeof (char) * (max_uid + 1));
convert_regs ();
+ any_malformed_asm = false;
free_aux_for_blocks ();
return true;
diff --git a/gcc/testsuite/gcc.target/i386/pr103097.c b/gcc/testsuite/gcc.target/i386/pr103097.c
new file mode 100644
index 00000000000..2b7a307deec
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103097.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fharden-conditional-branches" } */
+
+/* This is a slightly simplified version of
+ gcc.target/s390/vector/long-double-asm-earlyclobber.c. On x86, the f
+ constraints in asm statements imposes some requirements that the testcase
+ doesn't meet. What's unusual is that -fharden-conditional-branches extends
+ the effects of the malformed asm onto a different basic blocks, which
+ reg-stack did not expect. */
+
+#include <assert.h>
+#include <stdint.h>
+
+void
+f (void)
+{
+ long double res, x = 0;
+ asm("" : "=f"(res) /* { dg-error "must specify a single register" } */
+ : "0"(x));
+ assert (res == x);
+}
+
+void
+g (void)
+{
+ long double res, x = 0;
+ asm("" : "=g"(res) /* this is ok. */
+ : "0"(x));
+ assert (res == x);
+}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [PR103097] tolerate reg-stack cross-block malformed asms
@ 2021-12-04 7:06 Alexandre Oliva
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2021-12-04 7:06 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9984f7a1b50d741a0adbf3e2cdcc9c1f5e5d59fc
commit 9984f7a1b50d741a0adbf3e2cdcc9c1f5e5d59fc
Author: Alexandre Oliva <oliva@adacore.com>
Date: Sat Dec 4 03:49:32 2021 -0300
[PR103097] tolerate reg-stack cross-block malformed asms
Diff:
---
gcc/reg-stack.c | 3 +--
gcc/testsuite/gcc.target/i386/pr103097.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 1d9ea035cf4..a83ee253777 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -3014,8 +3014,6 @@ convert_regs_1 (basic_block block)
bool cfg_altered = false;
int debug_insns_with_starting_stack = 0;
- any_malformed_asm = false;
-
/* Choose an initial stack layout, if one hasn't already been chosen. */
if (bi->stack_in.top == -2)
{
@@ -3385,6 +3383,7 @@ reg_to_stack (void)
0, sizeof (char) * (max_uid + 1));
convert_regs ();
+ any_malformed_asm = false;
free_aux_for_blocks ();
return true;
diff --git a/gcc/testsuite/gcc.target/i386/pr103097.c b/gcc/testsuite/gcc.target/i386/pr103097.c
new file mode 100644
index 00000000000..13ced3b42db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103097.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fharden-conditional-branches" } */
+
+/* This is a slightly simplified version of
+ gcc.target/s390/vector/long-double-asm-earlyclobber.c. On x86, the f
+ constraints in asm statements imposes some requirements that the testcase
+ doesn't meet. What's unusual is that -fharden-conditional-branches extends
+ the effects of the malformed asm onto a different basic blocks, which
+ reg-stack did not expect. */
+
+#include <assert.h>
+#include <stdint.h>
+
+int
+main (void)
+{
+ long double res, x = 0;
+ asm("" : "=&f"(res) /* { dg-error "must specify a single register" } */
+ : "f"(x));
+ assert (res == x);
+}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-08 3:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 3:14 [gcc(refs/users/aoliva/heads/testme)] [PR103097] tolerate reg-stack cross-block malformed asms Alexandre Oliva
-- strict thread matches above, loose matches on Subject: below --
2021-12-04 9:22 Alexandre Oliva
2021-12-04 7:06 Alexandre Oliva
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).