aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2018-01-03 07:18:28 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-01-03 07:18:28 +0000
commit4871e1ed1728da22d48cfad1cb25a0a37f65d1bc (patch)
treefdd36d4cde99c5a28092606dfa451299faed8c76 /gcc
parent0f5d092808f4385d7618ba8463ad0d8843cc243c (diff)
downloadgcc-4871e1ed1728da22d48cfad1cb25a0a37f65d1bc.zip
gcc-4871e1ed1728da22d48cfad1cb25a0a37f65d1bc.tar.gz
gcc-4871e1ed1728da22d48cfad1cb25a0a37f65d1bc.tar.bz2
poly_int: expand_ifn_atomic_compare_exchange_into_call
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. 2018-01-03 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}. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r256157
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/builtins.c5
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fb3d07d..2eea29b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -2,6 +2,13 @@
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
+ * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Assert
+ that the mode size is in the set {1, 2, 4, 8, 16}.
+
+2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
+ Alan Hayward <alan.hayward@arm.com>
+ David Sherwood <david.sherwood@arm.com>
+
* var-tracking.c (adjust_mems): Treat mode sizes as polynomial.
Use plus_constant instead of gen_rtx_PLUS.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 98eb804..c5d8435 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5990,9 +5990,12 @@ expand_ifn_atomic_compare_exchange_into_call (gcall *call, machine_mode mode)
/* 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);