aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2016-07-18 10:47:09 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2016-07-18 10:47:09 +0000
commit54158a1aa94f7b75f59d6ca8d6ca7ebfc11e1673 (patch)
tree551d229cd8785ac2afb871f356d248c72a6a7a94 /gcc
parent2e7565b2681274a88ec2c74c6486ca4657295d21 (diff)
downloadgcc-54158a1aa94f7b75f59d6ca8d6ca7ebfc11e1673.zip
gcc-54158a1aa94f7b75f59d6ca8d6ca7ebfc11e1673.tar.gz
gcc-54158a1aa94f7b75f59d6ca8d6ca7ebfc11e1673.tar.bz2
S/390: Fix alignment check for literal pool references.
gcc/ChangeLog: 2016-07-18 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * config/s390/s390.c (s390_encode_section_info): Always set notaligned marker if mode size is 0 or no MEM_ALIGN info could be found. gcc/testsuite/ChangeLog: 2016-07-18 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * gcc.target/s390/nolrl-1.c: New test. From-SVN: r238427
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/s390/s390.c35
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/s390/nolrl-1.c19
4 files changed, 44 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1f3fabf..55a8771 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-07-18 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * config/s390/s390.c (s390_encode_section_info): Always set
+ notaligned marker if mode size is 0 or no MEM_ALIGN info could be
+ found.
+
2016-07-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/71893
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 9d2b2c0..318c021 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -12412,17 +12412,14 @@ s390_encode_section_info (tree decl, rtx rtl, int first)
{
/* Store the alignment to be able to check if we can use
a larl/load-relative instruction. We only handle the cases
- that can go wrong (i.e. no FUNC_DECLs). If a symref does
- not have any flag we assume it to be correctly aligned. */
-
- if (DECL_ALIGN (decl) % 64)
- SYMBOL_FLAG_SET_NOTALIGN8 (XEXP (rtl, 0));
-
- if (DECL_ALIGN (decl) % 32)
- SYMBOL_FLAG_SET_NOTALIGN4 (XEXP (rtl, 0));
-
- if (DECL_ALIGN (decl) == 0 || DECL_ALIGN (decl) % 16)
+ that can go wrong (i.e. no FUNC_DECLs). */
+ if (DECL_ALIGN (decl) == 0
+ || DECL_ALIGN (decl) % 16)
SYMBOL_FLAG_SET_NOTALIGN2 (XEXP (rtl, 0));
+ else if (DECL_ALIGN (decl) % 32)
+ SYMBOL_FLAG_SET_NOTALIGN4 (XEXP (rtl, 0));
+ else if (DECL_ALIGN (decl) % 64)
+ SYMBOL_FLAG_SET_NOTALIGN8 (XEXP (rtl, 0));
}
/* Literal pool references don't have a decl so they are handled
@@ -12430,18 +12427,16 @@ s390_encode_section_info (tree decl, rtx rtl, int first)
entry to decide upon the alignment. */
if (MEM_P (rtl)
&& GET_CODE (XEXP (rtl, 0)) == SYMBOL_REF
- && TREE_CONSTANT_POOL_ADDRESS_P (XEXP (rtl, 0))
- && MEM_ALIGN (rtl) != 0
- && GET_MODE_BITSIZE (GET_MODE (rtl)) != 0)
+ && TREE_CONSTANT_POOL_ADDRESS_P (XEXP (rtl, 0)))
{
- if (MEM_ALIGN (rtl) % 64)
- SYMBOL_FLAG_SET_NOTALIGN8 (XEXP (rtl, 0));
-
- if (MEM_ALIGN (rtl) % 32)
- SYMBOL_FLAG_SET_NOTALIGN4 (XEXP (rtl, 0));
-
- if (MEM_ALIGN (rtl) == 0 || MEM_ALIGN (rtl) % 16)
+ if (MEM_ALIGN (rtl) == 0
+ || GET_MODE_SIZE (GET_MODE (rtl)) == 0
+ || MEM_ALIGN (rtl) % 16)
SYMBOL_FLAG_SET_NOTALIGN2 (XEXP (rtl, 0));
+ else if (MEM_ALIGN (rtl) % 32)
+ SYMBOL_FLAG_SET_NOTALIGN4 (XEXP (rtl, 0));
+ else if (MEM_ALIGN (rtl) % 64)
+ SYMBOL_FLAG_SET_NOTALIGN8 (XEXP (rtl, 0));
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9568baa..f003287 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2016-07-18 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * gcc.target/s390/nolrl-1.c: New test.
+
2016-07-17 Fritz Reese <fritzoreese@gmail.com>
PR fortran/71523
diff --git a/gcc/testsuite/gcc.target/s390/nolrl-1.c b/gcc/testsuite/gcc.target/s390/nolrl-1.c
new file mode 100644
index 0000000..e0d1213
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nolrl-1.c
@@ -0,0 +1,19 @@
+/* Make sure the compiler does not try to use a relative long
+ instruction to load the string since it might not meet the
+ alignment requirements of the instruction. */
+
+/* { dg-do compile } */
+/* { dg-options "-march=z10 -O3 -mzarch" } */
+
+extern void foo (char*);
+
+void
+bar ()
+{
+ unsigned char z[32];
+
+ __builtin_memcpy (z, "\001\000\000\000", 4);
+ foo (z);
+}
+
+/* { dg-final { scan-assembler-not "lrl" } } */