+2020-05-21 Martin Liska <mliska@suse.cz>
+
+ * common/config/aarch64/aarch64-common.c (aarch64_handle_option):
+ Handle OPT_moutline_atomics.
+ * config/aarch64/aarch64.c: Add outline-atomics to
+ aarch64_attributes.
+ * doc/extend.texi: Document the newly added target attribute.
+
2020-05-21 Uroš Bizjak <ubizjak@gmail.com>
PR target/95218
opts->x_flag_omit_leaf_frame_pointer = val;
return true;
+ case OPT_moutline_atomics:
+ opts->x_aarch64_flag_outline_atomics = val;
+ return true;
+
default:
return true;
}
aarch64_handle_attr_branch_protection, OPT_mbranch_protection_ },
{ "sign-return-address", aarch64_attr_enum, false, NULL,
OPT_msign_return_address_ },
+ { "outline-atomics", aarch64_attr_bool, true, NULL,
+ OPT_moutline_atomics},
{ NULL, aarch64_attr_custom, false, NULL, OPT____ }
};
behavior and permissible arguments are the same as for the command-line option
@option{-mbranch-protection=}. The default value is @code{none}.
+@item outline-atomics
+@cindex @code{outline-atomics} function attribute, AArch64
+Enable or disable calls to out-of-line helpers to implement atomic operations.
+This corresponds to the behavior of the command line options
+@option{-moutline-atomics} and @option{-mno-outline-atomics}.
+
@end table
The above target attributes can be specified as follows:
+2020-05-21 Martin Liska <mliska@suse.cz>
+
+ * gcc.target/aarch64/target_attr_20.c: New test.
+ * gcc.target/aarch64/target_attr_21.c: New test.
+
2020-05-20 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* g++.dg/warn/Wconversion-null-2.C: Add explicit declarations for l()
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=armv8-a+nolse -moutline-atomics" } */
+
+int b, c, d, e, f, h;
+short g;
+int foo (int) __attribute__ ((__const__));
+
+__attribute__ ((target ("no-outline-atomics")))
+void
+bar (void)
+{
+ while (1)
+ {
+ while (1)
+ {
+ __atomic_load_n (&e, 0);
+ if (foo (2))
+ __sync_val_compare_and_swap (&c, 0, f);
+ b = 1;
+ if (h == e)
+ break;
+ }
+ __sync_val_compare_and_swap (&g, -1, f);
+ }
+}
+
+/* { dg-final { scan-assembler-not "bl.*__aarch64_cas2_acq_rel" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=armv8-a+nolse -mno-outline-atomics" } */
+
+int b, c, d, e, f, h;
+short g;
+int foo (int) __attribute__ ((__const__));
+
+__attribute__ ((target ("outline-atomics")))
+void
+bar (void)
+{
+ while (1)
+ {
+ while (1)
+ {
+ __atomic_load_n (&e, 0);
+ if (foo (2))
+ __sync_val_compare_and_swap (&c, 0, f);
+ b = 1;
+ if (h == e)
+ break;
+ }
+ __sync_val_compare_and_swap (&g, -1, f);
+ }
+}
+
+/* { dg-final { scan-assembler-times "bl.*__aarch64_cas2_acq_rel" 1 } } */