Implement C11 _Atomic
diff mbox

Message ID alpine.BSF.2.02.1311221140050.84324@arjuna.pair.com
State New
Headers show

Commit Message

Hans-Peter Nilsson Nov. 22, 2013, 4:46 p.m. UTC
On Fri, 22 Nov 2013, Andrew MacLeod wrote:
> The target hook patch is checked into mainline, revision 205273.

Thanks!

The target patch is there too now; tested with the previous
version of the hook-patch.  I'm confident my autotester will
yell at me if I goofed.

gcc:
	* config/cris/cris.c (cris_atomic_align_for_mode): New function.
	(TARGET_ATOMIC_ALIGN_FOR_MODE): Define.


brgds, H-P

Patch
diff mbox

Index: config/cris/cris.c
===================================================================
--- config/cris/cris.c	(revision 205225)
+++ config/cris/cris.c	(working copy)
@@ -93,6 +93,8 @@  static int cris_reg_overlap_mentioned_p
 static enum machine_mode cris_promote_function_mode (const_tree, enum machine_mode,
 						     int *, const_tree, int);

+static unsigned int cris_atomic_align_for_mode (enum machine_mode);
+
 static void cris_print_base (rtx, FILE *);

 static void cris_print_index (rtx, FILE *);
@@ -227,6 +229,9 @@  int cris_cpu_version = CRIS_DEFAULT_CPU_
 #undef TARGET_PROMOTE_FUNCTION_MODE
 #define TARGET_PROMOTE_FUNCTION_MODE cris_promote_function_mode

+#undef TARGET_ATOMIC_ALIGN_FOR_MODE
+#define TARGET_ATOMIC_ALIGN_FOR_MODE cris_atomic_align_for_mode
+
 #undef TARGET_STRUCT_VALUE_RTX
 #define TARGET_STRUCT_VALUE_RTX cris_struct_value_rtx
 #undef TARGET_SETUP_INCOMING_VARARGS
@@ -4018,6 +4023,14 @@  cris_promote_function_mode (const_tree t
     return mode;
   return CRIS_PROMOTED_MODE (mode, *punsignedp, type);
 }
+
+/* Atomic types require alignment to be at least their "natural" size.  */
+
+static unsigned int
+cris_atomic_align_for_mode (enum machine_mode mode)
+{
+  return GET_MODE_BITSIZE (mode);
+}

 /* Let's assume all functions return in r[CRIS_FIRST_ARG_REG] for the
    time being.  */