Hi, on S/390 128 bit atomic operations are not allowed for misaligned operands. The expanders are supposed to FAIL in that case. While it works for the other routines atomic_load/store it does not work currently during compare and swap expansion.
The patch just turns an expand_insn into maybe_expand_insn to allow other alternatives to be chosen when the expander fails. The patch is required to fix many c11-atomic* testcases on S/390. gcc.dg/atomic/c11-atomic-exec-5.c still fails since TARGET_ATOMIC_ASSIGN_EXPAND_FENV is not defined yet. Ok for mainline? 2014-02-07 Andreas Krebbel <andreas.kreb...@de.ibm.com> * optabs.c (expand_atomic_compare_and_swap): Allow expander to fail. commit 63b1953fadae985ef8302159dacbfc8bf541ec1f Author: Andreas Krebbel <kreb...@linux.vnet.ibm.com> Date: Fri Feb 7 12:50:50 2014 +0100 optabs: Allow compare and swap expanders to fail diff --git a/gcc/optabs.c b/gcc/optabs.c index e36fd13..cec25a4 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -7383,12 +7383,13 @@ expand_atomic_compare_and_swap (rtx *ptarget_bool, rtx *ptarget_oval, create_integer_operand (&ops[5], is_weak); create_integer_operand (&ops[6], succ_model); create_integer_operand (&ops[7], fail_model); - expand_insn (icode, 8, ops); - - /* Return success/failure. */ - target_bool = ops[0].value; - target_oval = ops[1].value; - goto success; + if (maybe_expand_insn (icode, 8, ops)) + { + /* Return success/failure. */ + target_bool = ops[0].value; + target_oval = ops[1].value; + goto success; + } } /* Otherwise fall back to the original __sync_val_compare_and_swap