Message ID | 87inf5epef.fsf@linaro.org |
---|---|
State | New |
Headers | show |
Series | [094/nnn] poly_int: expand_ifn_atomic_compare_exchange_into_call | expand |
On 10/23/2017 11:37 AM, Richard Sandiford wrote: > This patch makes the mode size assumptions in > expand_ifn_atomic_compare_exchange_into_call a bit more > explicit, so that a later patch can add a to_constant () call. > > > 2017-10-23 Richard Sandiford <richard.sandiford@linaro.org> > Alan Hayward <alan.hayward@arm.com> > David Sherwood <david.sherwood@arm.com> > > gcc/ > * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Assert > that the mode size is in the set {1, 2, 4, 8, 16}. OK. jeff
Index: gcc/builtins.c =================================================================== --- gcc/builtins.c 2017-10-23 17:22:18.226824652 +0100 +++ gcc/builtins.c 2017-10-23 17:25:41.647742640 +0100 @@ -5838,9 +5838,12 @@ expand_ifn_atomic_compare_exchange_into_ /* Skip the boolean weak parameter. */ for (z = 4; z < 6; z++) vec->quick_push (gimple_call_arg (call, z)); + /* At present we only have BUILT_IN_ATOMIC_COMPARE_EXCHANGE_{1,2,4,8,16}. */ + unsigned int bytes_log2 = exact_log2 (GET_MODE_SIZE (mode)); + gcc_assert (bytes_log2 < 5); built_in_function fncode = (built_in_function) ((int) BUILT_IN_ATOMIC_COMPARE_EXCHANGE_1 - + exact_log2 (GET_MODE_SIZE (mode))); + + bytes_log2); tree fndecl = builtin_decl_explicit (fncode); tree fn = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fndecl)), fndecl);