|
|
22033d |
commit 93ed472702aad6d9b8998592775a0ab4120b6242
|
|
|
22033d |
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
|
|
|
22033d |
Date: Wed Sep 20 21:59:50 2017 +0000
|
|
|
22033d |
|
|
|
22033d |
* explow.c (compute_stack_clash_protection_loop_data): Use
|
|
|
22033d |
CONST_INT_P instead of explicit test. Verify object is a
|
|
|
22033d |
CONST_INT_P before looking at INTVAL.
|
|
|
22033d |
(anti_adjust_stack_and_probe_stack_clash): Use CONST_INT_P
|
|
|
22033d |
instead of explicit test.
|
|
|
22033d |
|
|
|
22033d |
* gcc.target/i386/stack-check-11.c: Update test and regexp
|
|
|
22033d |
so that it works for both i?86 and x86_64.
|
|
|
22033d |
|
|
|
22033d |
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253034 138bc75d-0d04-0410-961f-82ee72b054a4
|
|
|
22033d |
|
|
|
22033d |
diff --git a/gcc/explow.c b/gcc/explow.c
|
|
|
22033d |
index 2526e8513b7..d118e0d7782 100644
|
|
|
22033d |
--- a/gcc/explow.c
|
|
|
22033d |
+++ b/gcc/explow.c
|
|
|
22033d |
@@ -1778,11 +1778,11 @@ compute_stack_clash_protection_loop_data (rtx *rounded_size, rtx *last_addr,
|
|
|
22033d |
if (*rounded_size == CONST0_RTX (Pmode))
|
|
|
22033d |
fprintf (dump_file,
|
|
|
22033d |
"Stack clash skipped dynamic allocation and probing loop.\n");
|
|
|
22033d |
- else if (GET_CODE (*rounded_size) == CONST_INT
|
|
|
22033d |
+ else if (CONST_INT_P (*rounded_size)
|
|
|
22033d |
&& INTVAL (*rounded_size) <= 4 * *probe_interval)
|
|
|
22033d |
fprintf (dump_file,
|
|
|
22033d |
"Stack clash dynamic allocation and probing inline.\n");
|
|
|
22033d |
- else if (GET_CODE (*rounded_size) == CONST_INT)
|
|
|
22033d |
+ else if (CONST_INT_P (*rounded_size))
|
|
|
22033d |
fprintf (dump_file,
|
|
|
22033d |
"Stack clash dynamic allocation and probing in "
|
|
|
22033d |
"rotated loop.\n");
|
|
|
22033d |
@@ -1880,7 +1880,8 @@ anti_adjust_stack_and_probe_stack_clash (rtx size)
|
|
|
22033d |
|
|
|
22033d |
if (rounded_size != CONST0_RTX (Pmode))
|
|
|
22033d |
{
|
|
|
22033d |
- if (INTVAL (rounded_size) <= 4 * probe_interval)
|
|
|
22033d |
+ if (CONST_INT_P (rounded_size)
|
|
|
22033d |
+ && INTVAL (rounded_size) <= 4 * probe_interval)
|
|
|
22033d |
{
|
|
|
22033d |
for (HOST_WIDE_INT i = 0;
|
|
|
22033d |
i < INTVAL (rounded_size);
|
|
|
22033d |
@@ -1900,7 +1901,7 @@ anti_adjust_stack_and_probe_stack_clash (rtx size)
|
|
|
22033d |
else
|
|
|
22033d |
{
|
|
|
22033d |
rtx loop_lab, end_loop;
|
|
|
22033d |
- bool rotate_loop = GET_CODE (rounded_size) == CONST_INT;
|
|
|
22033d |
+ bool rotate_loop = CONST_INT_P (rounded_size);
|
|
|
22033d |
emit_stack_clash_protection_probe_loop_start (&loop_lab, &end_loop,
|
|
|
22033d |
last_addr, rotate_loop);
|
|
|
22033d |
|
|
|
22033d |
@@ -1938,7 +1939,7 @@ anti_adjust_stack_and_probe_stack_clash (rtx size)
|
|
|
22033d |
might hold live data. So probe at *sp if we know that
|
|
|
22033d |
an allocation was made, otherwise probe into the red zone
|
|
|
22033d |
which is obviously undesirable. */
|
|
|
22033d |
- if (GET_CODE (size) == CONST_INT)
|
|
|
22033d |
+ if (CONST_INT_P (size))
|
|
|
22033d |
{
|
|
|
22033d |
emit_stack_probe (stack_pointer_rtx);
|
|
|
22033d |
emit_insn (gen_blockage ());
|
|
|
22033d |
diff --git a/gcc/testsuite/gcc.target/i386/stack-check-11.c b/gcc/testsuite/gcc.target/i386/stack-check-11.c
|
|
|
22033d |
index 183103f01e5..fe5b2c2b844 100644
|
|
|
22033d |
--- a/gcc/testsuite/gcc.target/i386/stack-check-11.c
|
|
|
22033d |
+++ b/gcc/testsuite/gcc.target/i386/stack-check-11.c
|
|
|
22033d |
@@ -2,15 +2,17 @@
|
|
|
22033d |
/* { dg-options "-O2 -fstack-clash-protection" } */
|
|
|
22033d |
/* { dg-require-effective-target supports_stack_clash_protection } */
|
|
|
22033d |
|
|
|
22033d |
-extern void arf (unsigned long int *, unsigned long int *);
|
|
|
22033d |
+#include <stdint.h>
|
|
|
22033d |
+
|
|
|
22033d |
+extern void arf (uint64_t *, uint64_t *);
|
|
|
22033d |
void
|
|
|
22033d |
frob ()
|
|
|
22033d |
{
|
|
|
22033d |
- unsigned long int num[859];
|
|
|
22033d |
- unsigned long int den[859];
|
|
|
22033d |
+ uint64_t num[859];
|
|
|
22033d |
+ uint64_t den[859];
|
|
|
22033d |
arf (den, num);
|
|
|
22033d |
}
|
|
|
22033d |
|
|
|
22033d |
-/* { dg-final { scan-assembler-times "subq" 4 } } */
|
|
|
22033d |
-/* { dg-final { scan-assembler-times "orq" 3 } } */
|
|
|
22033d |
+/* { dg-final { scan-assembler-times "sub\[ql\]" 4 } } */
|
|
|
22033d |
+/* { dg-final { scan-assembler-times "or\[ql\]" 3 } } */
|
|
|
22033d |
|