mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-22 11:41:07 +08:00
S/390: Add support for section anchors
gcc/ChangeLog: 2018-12-03 Ilya Leoshkevich <iii@linux.ibm.com> * common/config/s390/s390-common.c (s390_option_init_struct): Use section anchors by default. * config/s390/s390.c (s390_check_symref_alignment): Handle anchors. (TARGET_MAX_ANCHOR_OFFSET): Use short displacement. * output.h (assemble_align): Pass `align' as unsigned int, so that the value 0x80000000, which corresponds to `aligned(1 << 28)', would pass the `align > BITS_PER_UNIT' check. * varasm.c (assemble_align): Likewise. gcc/testsuite/ChangeLog: 2018-12-03 Ilya Leoshkevich <iii@linux.ibm.com> * gcc.target/s390/nodatarel-1.c: Expect .LANCHOR0@GOTENT instead of a@GOTENT. * gcc.target/s390/section-anchors.c: New test. * gcc.target/s390/section-anchors2.c: New test. * gcc.target/s390/section-anchors3.c: New test. From-SVN: r266741
This commit is contained in:
parent
df3fdfa67f
commit
8c66130b1f
@ -1,3 +1,15 @@
|
||||
2018-12-03 Ilya Leoshkevich <iii@linux.ibm.com>
|
||||
|
||||
* common/config/s390/s390-common.c (s390_option_init_struct):
|
||||
Use section anchors by default.
|
||||
* config/s390/s390.c (s390_check_symref_alignment): Handle
|
||||
anchors.
|
||||
(TARGET_MAX_ANCHOR_OFFSET): Use short displacement.
|
||||
* output.h (assemble_align): Pass `align' as unsigned int, so
|
||||
that the value 0x80000000, which corresponds to `aligned(1 <<
|
||||
28)', would pass the `align > BITS_PER_UNIT' check.
|
||||
* varasm.c (assemble_align): Likewise.
|
||||
|
||||
2018-12-03 Julian Brown <julian@codesourcery.com>
|
||||
|
||||
* tree-pretty-print.c (dump_omp_clause): Make default case
|
||||
|
@ -74,6 +74,9 @@ s390_option_init_struct (struct gcc_options *opts)
|
||||
/* By default, always emit DWARF-2 unwind info. This allows debugging
|
||||
without maintaining a stack frame back-chain. */
|
||||
opts->x_flag_asynchronous_unwind_tables = 1;
|
||||
|
||||
/* Enable section anchors by default. */
|
||||
opts->x_flag_section_anchors = 1;
|
||||
}
|
||||
|
||||
/* Implement TARGET_HANDLE_OPTION. */
|
||||
|
@ -4187,6 +4187,20 @@ s390_check_symref_alignment (rtx addr, HOST_WIDE_INT alignment)
|
||||
|
||||
if (GET_CODE (symref) == SYMBOL_REF)
|
||||
{
|
||||
/* s390_encode_section_info is not called for anchors, since they don't
|
||||
have corresponding VAR_DECLs. Therefore, we cannot rely on
|
||||
SYMBOL_FLAG_NOTALIGN{2,4,8}_P returning useful information. */
|
||||
if (SYMBOL_REF_ANCHOR_P (symref))
|
||||
{
|
||||
HOST_WIDE_INT block_offset = SYMBOL_REF_BLOCK_OFFSET (symref);
|
||||
unsigned int block_alignment = (SYMBOL_REF_BLOCK (symref)->alignment
|
||||
/ BITS_PER_UNIT);
|
||||
|
||||
gcc_assert (block_offset >= 0);
|
||||
return ((block_offset & (alignment - 1)) == 0
|
||||
&& block_alignment >= alignment);
|
||||
}
|
||||
|
||||
/* We have load-relative instructions for 2-byte, 4-byte, and
|
||||
8-byte alignment so allow only these. */
|
||||
switch (alignment)
|
||||
@ -16338,6 +16352,11 @@ s390_case_values_threshold (void)
|
||||
#undef TARGET_CASE_VALUES_THRESHOLD
|
||||
#define TARGET_CASE_VALUES_THRESHOLD s390_case_values_threshold
|
||||
|
||||
/* Use only short displacement, since long displacement is not available for
|
||||
the floating point instructions. */
|
||||
#undef TARGET_MAX_ANCHOR_OFFSET
|
||||
#define TARGET_MAX_ANCHOR_OFFSET 0xfff
|
||||
|
||||
struct gcc_target targetm = TARGET_INITIALIZER;
|
||||
|
||||
#include "gt-s390.h"
|
||||
|
@ -219,7 +219,7 @@ extern void assemble_external (tree);
|
||||
extern void assemble_zeros (unsigned HOST_WIDE_INT);
|
||||
|
||||
/* Assemble an alignment pseudo op for an ALIGN-bit boundary. */
|
||||
extern void assemble_align (int);
|
||||
extern void assemble_align (unsigned int);
|
||||
|
||||
/* Assemble a string constant with the specified C string as contents. */
|
||||
extern void assemble_string (const char *, int);
|
||||
|
@ -1,3 +1,11 @@
|
||||
2018-12-03 Ilya Leoshkevich <iii@linux.ibm.com>
|
||||
|
||||
* gcc.target/s390/nodatarel-1.c: Expect .LANCHOR0@GOTENT instead
|
||||
of a@GOTENT.
|
||||
* gcc.target/s390/section-anchors.c: New test.
|
||||
* gcc.target/s390/section-anchors2.c: New test.
|
||||
* gcc.target/s390/section-anchors3.c: New test.
|
||||
|
||||
2018-12-03 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/88301
|
||||
|
@ -29,7 +29,7 @@ bar (int b)
|
||||
a = b;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times "a@GOTENT" 3 } } */
|
||||
/* { dg-final { scan-assembler-times "\\.LANCHOR\\d+@GOTENT" 3 } } */
|
||||
|
||||
/* The exrl target is a label_ref which should not be affected at
|
||||
all. */
|
||||
|
14
gcc/testsuite/gcc.target/s390/section-anchors.c
Normal file
14
gcc/testsuite/gcc.target/s390/section-anchors.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* Test basic section anchor functionality. */
|
||||
|
||||
/* { dg-do compile { target { lp64 } } } */
|
||||
/* { dg-options "-O3 -march=z13" } */
|
||||
|
||||
int a = 1, b = 2;
|
||||
|
||||
void
|
||||
f ()
|
||||
{
|
||||
a = 1234;
|
||||
b = 5678;
|
||||
/* { dg-final { scan-assembler {(?n)\n\tlarl\t(%r\d+),\.LANCHOR\d+\n\tmvhi\t\d+\(\1\),1234\n\tmvhi\t\d+\(\1\),5678} } } */
|
||||
}
|
26
gcc/testsuite/gcc.target/s390/section-anchors2.c
Normal file
26
gcc/testsuite/gcc.target/s390/section-anchors2.c
Normal file
@ -0,0 +1,26 @@
|
||||
/* Test corner case when LG from literal pool could be preferred to LARL. */
|
||||
|
||||
/* { dg-do compile { target { lp64 } } } */
|
||||
/* { dg-options "-O3 -march=z13" } */
|
||||
|
||||
int e = 42;
|
||||
int *c = &e;
|
||||
|
||||
void
|
||||
h (int *i)
|
||||
{
|
||||
c = i;
|
||||
}
|
||||
|
||||
void
|
||||
j ()
|
||||
{
|
||||
h (&e);
|
||||
/* { dg-final { scan-assembler {(?n)\n\tlarl\t.+\n\tstgrl\t.+\n\tbr\t%r14\n} } } */
|
||||
}
|
||||
|
||||
void
|
||||
f ()
|
||||
{
|
||||
h (c);
|
||||
}
|
11
gcc/testsuite/gcc.target/s390/section-anchors3.c
Normal file
11
gcc/testsuite/gcc.target/s390/section-anchors3.c
Normal file
@ -0,0 +1,11 @@
|
||||
/* Test corner case when LG from literal pool could be preferred to LARL. */
|
||||
|
||||
/* { dg-do compile { target { lp64 } } } */
|
||||
/* { dg-options "-O3 -march=z13" } */
|
||||
|
||||
int
|
||||
a (int b)
|
||||
{
|
||||
return b / 100;
|
||||
/* { dg-final { scan-assembler-not {\n\t\.quad\t\.LC} } } */
|
||||
}
|
@ -1974,7 +1974,7 @@ assemble_zeros (unsigned HOST_WIDE_INT size)
|
||||
/* Assemble an alignment pseudo op for an ALIGN-bit boundary. */
|
||||
|
||||
void
|
||||
assemble_align (int align)
|
||||
assemble_align (unsigned int align)
|
||||
{
|
||||
if (align > BITS_PER_UNIT)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user