aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorFaraz Shahbazker <fshahbazker@wavecomp.com>2019-06-11 20:09:57 +0000
committerJeff Law <law@gcc.gnu.org>2019-06-11 14:09:57 -0600
commit9570f46f965fa317b394b1d9163c1ceb597023fc (patch)
tree1d2724594536f5e694bff5929506f9e71ffd5ddc /gcc
parent536b4592a148f505114db8ee6ba1e8809686ab1f (diff)
downloadgcc-9570f46f965fa317b394b1d9163c1ceb597023fc.zip
gcc-9570f46f965fa317b394b1d9163c1ceb597023fc.tar.gz
gcc-9570f46f965fa317b394b1d9163c1ceb597023fc.tar.bz2
mips.c (mips_final_postscan_insn): Modify call to `mips_set_text_contents_type' to indicate whether a non-debug...
* config/mips/mips.c (mips_final_postscan_insn): Modify call to `mips_set_text_contents_type' to indicate whether a non-debug insn follows. * gcc.target/mips/data-sym-pool.c: Update expected output. * gcc.target/mips/data-sym-multi-pool.c: New test. From-SVN: r272169
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/mips/mips.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/mips/data-sym-multi-pool.c45
-rw-r--r--gcc/testsuite/gcc.target/mips/data-sym-pool.c5
5 files changed, 71 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bf0dc94..ba25766 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-06-11 Faraz Shahbazker <fshahbazker@wavecomp.com>
+
+ * config/mips/mips.c (mips_final_postscan_insn): Modify call
+ to `mips_set_text_contents_type' to indicate whether a
+ non-debug insn follows.
+
2019-06-11 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/rs6000-cpus.def (ISA_FUTURE_MASKS_SERVER): Delete
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index c6433dc..0e1a68a 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -20636,9 +20636,19 @@ mips_final_postscan_insn (FILE *file ATTRIBUTE_UNUSED, rtx_insn *insn,
if (INSN_P (insn)
&& GET_CODE (PATTERN (insn)) == UNSPEC_VOLATILE
&& XINT (PATTERN (insn), 1) == UNSPEC_CONSTTABLE_END)
- mips_set_text_contents_type (asm_out_file, "__pend_",
- INTVAL (XVECEXP (PATTERN (insn), 0, 0)),
- TRUE);
+ {
+ rtx_insn *next_insn = next_real_nondebug_insn (insn);
+ bool code_p = (next_insn != NULL
+ && INSN_P (next_insn)
+ && (GET_CODE (PATTERN (next_insn)) != UNSPEC_VOLATILE
+ || XINT (PATTERN (next_insn), 1) != UNSPEC_CONSTTABLE));
+
+ /* Switch content type depending on whether there is code beyond
+ the constant pool. */
+ mips_set_text_contents_type (asm_out_file, "__pend_",
+ INTVAL (XVECEXP (PATTERN (insn), 0, 0)),
+ code_p);
+ }
}
/* Return the function that is used to expand the <u>mulsidi3 pattern.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4430844..302ac15 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-11 Faraz Shahbazker <fshahbazker@wavecomp.com>
+
+ * gcc.target/mips/data-sym-pool.c: Update expected output.
+ * gcc.target/mips/data-sym-multi-pool.c: New test.
+
2019-06-11 Iain Sandoe <iain@sandoe.co.uk>
PR testsuite/65364
diff --git a/gcc/testsuite/gcc.target/mips/data-sym-multi-pool.c b/gcc/testsuite/gcc.target/mips/data-sym-multi-pool.c
new file mode 100644
index 0000000..1936f5b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/data-sym-multi-pool.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-mips16 -mcode-readable=yes" } */
+/* { dg-skip-if "per-function expected output" { *-*-* } { "-flto" } { "" } } */
+
+/* This testcase generates multiple constant pools within a function body. */
+
+#define C(a,b) \
+ if (a > b) goto gt; \
+ if (a < b) goto lt;
+
+#define C4(x,b) C((x)[0], b) C((x)[1],b) C((x)[2],b) C((x)[3],b)
+#define C16(x,y) C4(x, (y)[0]) C4(x, (y)[1]) C4(x, (y)[2]) C4(x, (y)[3])
+
+#define C64(x,y) C16(x,y) C16(x+4,y) C16(x+8,y)
+#define C256(x,y) C64(x,y) C64(x,y+4) C64(x,y+8)
+
+unsigned foo(int x[64], int y[64])
+{
+ C256(x,y);
+
+ return 0x01234567;
+ gt:
+ return 0x12345678;
+ lt:
+ return 0xF0123456;
+}
+
+/* Check that:
+1. The __pend symbol is emitted as STT_FUNCTION followed by instructions:
+ .type __pend_frob_<X>, @function # Symbol # must match label.
+__pend_foo_<X>: # The symbol must match.
+ .insn
+.L<Y>:
+
+2. __pend symbol at end of function has type STT_OBJECT
+
+ .type __pend_foo_<X>, @object
+__pend_foo_<X>:
+ .insn
+ .end foo
+
+ */
+
+/* { dg-final { scan-assembler "\t\\.type\t(__pend_foo_\[0-9\]+), @function\n\\1:\n\t\\.insn\n.L\[0-9\]+:\n" } } */
+/* { dg-final { scan-assembler "\t\\.type\t(__pend_foo_\[0-9\]+), @object\n\\1:\n\t\\.end\tfoo\n" } } */
diff --git a/gcc/testsuite/gcc.target/mips/data-sym-pool.c b/gcc/testsuite/gcc.target/mips/data-sym-pool.c
index 8776d2b..f093511 100644
--- a/gcc/testsuite/gcc.target/mips/data-sym-pool.c
+++ b/gcc/testsuite/gcc.target/mips/data-sym-pool.c
@@ -16,9 +16,8 @@ __pool_frob_3: # The symbol must match.
.align 2
$L3: # The label must match.
.word 305419896
- .type __pend_frob_3, @function # Symbol # must match label.
+ .type __pend_frob_3, @object # Symbol # must match label.
__pend_frob_3: # The symbol must match.
- .insn
that is `__pool_*'/`__pend_*' symbols inserted around a constant pool.
@@ -26,4 +25,4 @@ __pend_frob_3: # The symbol must match.
symbol from being placed in the constant pool at `-O0' for SVR4 code
and consequently interfering with test expectations. */
-/* { dg-final { scan-assembler "\tl\[wd\]\t\\\$\[0-9\]+,(.L(\[0-9\]+))\n.*\t\\.type\t(__pool_frob_\\2), @object\n\\3:\n\t\\.align\t2\n\\1:\n\t\\.d?word\t305419896\n\t\\.type\t(__pend_frob_\\2), @function\n\\4:\n\t\\.insn\n" } } */
+/* { dg-final { scan-assembler "\tl\[wd\]\t\\\$\[0-9\]+,(.L(\[0-9\]+))\n.*\t\\.type\t(__pool_frob_\\2), @object\n\\3:\n\t\\.align\t2\n\\1:\n\t\\.d?word\t305419896\n\t\\.type\t(__pend_frob_\\2), @object\n\\4:\n" } } */