From: Claudiu Zissulescu <claz...@gmail.com>

Use munaligned-access to control if we can have unaligned accesses.  For ARC
HS family unaligned access is always on.

2017-10-19  Claudiu Zissulescu  <claz...@synopsys.com>

        * config/arc/arc-c.def (__ARC_UNALIGNED__): New define.
        * config/arc/arc.h (STRICT_ALIGNMENT): Control this macro using
        munaligned-access.
---
 gcc/config/arc/arc-c.def | 1 +
 gcc/config/arc/arc.h     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/arc/arc-c.def b/gcc/config/arc/arc-c.def
index c9443c9..86eab4e 100644
--- a/gcc/config/arc/arc-c.def
+++ b/gcc/config/arc/arc-c.def
@@ -29,6 +29,7 @@ ARC_C_DEF ("__ARC_MUL64__",   TARGET_MUL64_SET)
 ARC_C_DEF ("__ARC_MUL32BY16__", TARGET_MULMAC_32BY16_SET)
 ARC_C_DEF ("__ARC_SIMD__",     TARGET_SIMD_SET)
 ARC_C_DEF ("__ARC_RF16__",     TARGET_RF16)
+ARC_C_DEF ("__ARC_UNALIGNED__",        !STRICT_ALIGNMENT)
 
 ARC_C_DEF ("__ARC_BARREL_SHIFTER__", TARGET_BARREL_SHIFTER)
 
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 8d90975..8c31fb2 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -288,7 +288,7 @@ if (GET_MODE_CLASS (MODE) == MODE_INT               \
 /* On the ARC the lower address bits are masked to 0 as necessary.  The chip
    won't croak when given an unaligned address, but the insn will still fail
    to produce the correct result.  */
-#define STRICT_ALIGNMENT 1
+#define STRICT_ALIGNMENT (!unaligned_access && !TARGET_HS)
 
 /* Layout of source language data types.  */
 
-- 
1.9.1

Reply via email to