{
/* 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
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));
}
}
--- /dev/null
+/* 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" } } */