aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2016-01-13 09:03:42 -0800
committerRichard Henderson <rth@gcc.gnu.org>2016-01-13 09:03:42 -0800
commit4c868789e492c923f3e8736d92eeaac352518151 (patch)
treef728a754bf3a0dcace0dede256cd49817a1cc56e /gcc/tree.c
parentef6d1772682f6929016159bb23a5640a9676718a (diff)
downloadgcc-4c868789e492c923f3e8736d92eeaac352518151.zip
gcc-4c868789e492c923f3e8736d92eeaac352518151.tar.gz
gcc-4c868789e492c923f3e8736d92eeaac352518151.tar.bz2
re PR target/68964 (Internal compiler error for test case gcc.dg/tm/20100610.c since r231674)
PR 68964 gcc/ PR tree-opt/68964 * target.def (builtin_tm_load, builtin_tm_store): Remove. * config/i386/i386.c (ix86_builtin_tm_load): Remove. (ix86_builtin_tm_store): Remove. (TARGET_VECTORIZE_BUILTIN_TM_LOAD): Remove. (TARGET_VECTORIZE_BUILTIN_TM_STORE): Remove. * doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_TM_LOAD): Remove. (TARGET_VECTORIZE_BUILTIN_TM_STORE): Remove. * doc/tm.texi: Rebuild. * gtm-builtins.def (BUILT_IN_TM_MEMCPY_RNWT): New. (BUILT_IN_TM_MEMCPY_RTWN): New. * trans-mem.c (tm_log_emit_stmt): Rearrange code for better fallback from vector to integer helpers. (build_tm_load): Handle vector types directly, instead of via target hook. (build_tm_store): Likewise. (expand_assign_tm): Prepare for register types not handled by the above. Copy them to memory and use memcpy. * tree.c (tm_define_builtin): New. (find_tm_vector_type): New. (build_tm_vector_builtins): New. (build_common_builtin_nodes): Call it. libitm/ * Makefile.am (libitm_la_SOURCES) [ARCH_AARCH64]: Add vect128.cc (libitm_la_SOURCES) [ARCH_ARM]: Add neon.cc (libitm_la_SOURCES) [ARCH_PPC]: Add vect128.cc (libitm_la_SOURCES) [ARCH_S390]: Add vect128.cc * configure.ac (ARCH_AARCH64): New conditional. (ARCH_PPC, ARCH_S390): Likewise. * Makefile.in, configure: Rebuild. * libitm.h (_ITM_TYPE_M128): Always define. * vect64.cc: Split ... * vect128.cc: ... out of... * config/x86/x86_sse.cc: ... here. * config/arm/neon.cc: New file. From-SVN: r232330
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c138
1 files changed, 138 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 20470c5..e6880f0 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -10330,6 +10330,143 @@ local_define_builtin (const char *name, tree type, enum built_in_function code,
set_builtin_decl (code, decl, true);
}
+/* A subroutine of build_tm_vector_builtins. Define a builtin with
+ all of the appropriate attributes. */
+static void
+tm_define_builtin (const char *name, tree type, built_in_function code,
+ tree decl_attrs, tree type_attrs)
+{
+ tree decl = add_builtin_function (name, type, code, BUILT_IN_NORMAL,
+ name + strlen ("__builtin_"), decl_attrs);
+ decl_attributes (&TREE_TYPE (decl), type_attrs, ATTR_FLAG_BUILT_IN);
+ set_builtin_decl (code, decl, true);
+}
+
+/* A subroutine of build_tm_vector_builtins. Find a supported vector
+ type VECTOR_BITS wide with inner mode ELEM_MODE. */
+static tree
+find_tm_vector_type (unsigned vector_bits, machine_mode elem_mode)
+{
+ unsigned elem_bits = GET_MODE_BITSIZE (elem_mode);
+ unsigned nunits = vector_bits / elem_bits;
+
+ gcc_assert (elem_bits * nunits == vector_bits);
+
+ machine_mode vector_mode = mode_for_vector (elem_mode, nunits);
+ if (!VECTOR_MODE_P (vector_mode)
+ || !targetm.vector_mode_supported_p (vector_mode))
+ return NULL_TREE;
+
+ tree innertype = lang_hooks.types.type_for_mode (elem_mode, 0);
+ return build_vector_type_for_mode (innertype, vector_mode);
+}
+
+/* A subroutine of build_common_builtin_nodes. Define TM builtins for
+ vector types. This is done after the target hook, so that the target
+ has a chance to override these. */
+static void
+build_tm_vector_builtins (void)
+{
+ tree vtype, pvtype, ftype, decl;
+ tree attrs_load, attrs_type_load;
+ tree attrs_store, attrs_type_store;
+ tree attrs_log, attrs_type_log;
+
+ /* Do nothing if TM is turned off, either with switch or
+ not enabled in the language. */
+ if (!flag_tm || !builtin_decl_explicit_p (BUILT_IN_TM_LOAD_1))
+ return;
+
+ /* Use whatever attributes a normal TM load has. */
+ decl = builtin_decl_explicit (BUILT_IN_TM_LOAD_1);
+ attrs_load = DECL_ATTRIBUTES (decl);
+ attrs_type_load = TYPE_ATTRIBUTES (TREE_TYPE (decl));
+ /* Use whatever attributes a normal TM store has. */
+ decl = builtin_decl_explicit (BUILT_IN_TM_STORE_1);
+ attrs_store = DECL_ATTRIBUTES (decl);
+ attrs_type_store = TYPE_ATTRIBUTES (TREE_TYPE (decl));
+ /* Use whatever attributes a normal TM log has. */
+ decl = builtin_decl_explicit (BUILT_IN_TM_LOG);
+ attrs_log = DECL_ATTRIBUTES (decl);
+ attrs_type_log = TYPE_ATTRIBUTES (TREE_TYPE (decl));
+
+ /* By default, 64 bit vectors go through the long long helpers. */
+
+ /* If a 128-bit vector is supported, declare those builtins. */
+ if (!builtin_decl_declared_p (BUILT_IN_TM_STORE_M128)
+ && ((vtype = find_tm_vector_type (128, SImode))
+ || (vtype = find_tm_vector_type (128, SFmode))))
+ {
+ pvtype = build_pointer_type (vtype);
+
+ ftype = build_function_type_list (void_type_node, pvtype, vtype, NULL);
+ tm_define_builtin ("__builtin__ITM_WM128", ftype,
+ BUILT_IN_TM_STORE_M128,
+ attrs_store, attrs_type_store);
+ tm_define_builtin ("__builtin__ITM_WaRM128", ftype,
+ BUILT_IN_TM_STORE_WAR_M128,
+ attrs_store, attrs_type_store);
+ tm_define_builtin ("__builtin__ITM_WaWM128", ftype,
+ BUILT_IN_TM_STORE_WAW_M128,
+ attrs_store, attrs_type_store);
+
+ ftype = build_function_type_list (vtype, pvtype, NULL);
+ tm_define_builtin ("__builtin__ITM_RM128", ftype,
+ BUILT_IN_TM_LOAD_M128,
+ attrs_load, attrs_type_load);
+ tm_define_builtin ("__builtin__ITM_RaRM128", ftype,
+ BUILT_IN_TM_LOAD_RAR_M128,
+ attrs_load, attrs_type_load);
+ tm_define_builtin ("__builtin__ITM_RaWM128", ftype,
+ BUILT_IN_TM_LOAD_RAW_M128,
+ attrs_load, attrs_type_load);
+ tm_define_builtin ("__builtin__ITM_RfWM128", ftype,
+ BUILT_IN_TM_LOAD_RFW_M128,
+ attrs_load, attrs_type_load);
+
+ ftype = build_function_type_list (void_type_node, pvtype, NULL);
+ tm_define_builtin ("__builtin__ITM_LM128", ftype,
+ BUILT_IN_TM_LOG_M128, attrs_log, attrs_type_log);
+ }
+
+ /* If a 256-bit vector is supported, declare those builtins. */
+ if (!builtin_decl_declared_p (BUILT_IN_TM_STORE_M256)
+ && ((vtype = find_tm_vector_type (256, SImode))
+ || (vtype = find_tm_vector_type (256, SFmode))))
+ {
+ pvtype = build_pointer_type (vtype);
+
+ ftype = build_function_type_list (void_type_node, pvtype, vtype, NULL);
+ tm_define_builtin ("__builtin__ITM_WM256", ftype,
+ BUILT_IN_TM_STORE_M256,
+ attrs_store, attrs_type_store);
+ tm_define_builtin ("__builtin__ITM_WaRM256", ftype,
+ BUILT_IN_TM_STORE_WAR_M256,
+ attrs_store, attrs_type_store);
+ tm_define_builtin ("__builtin__ITM_WaWM256", ftype,
+ BUILT_IN_TM_STORE_WAW_M256,
+ attrs_store, attrs_type_store);
+
+ ftype = build_function_type_list (vtype, pvtype, NULL);
+ tm_define_builtin ("__builtin__ITM_RM256", ftype,
+ BUILT_IN_TM_LOAD_M256,
+ attrs_load, attrs_type_load);
+ tm_define_builtin ("__builtin__ITM_RaRM256", ftype,
+ BUILT_IN_TM_LOAD_RAR_M256,
+ attrs_load, attrs_type_load);
+ tm_define_builtin ("__builtin__ITM_RaWM256", ftype,
+ BUILT_IN_TM_LOAD_RAW_M256,
+ attrs_load, attrs_type_load);
+ tm_define_builtin ("__builtin__ITM_RfWM256", ftype,
+ BUILT_IN_TM_LOAD_RFW_M256,
+ attrs_load, attrs_type_load);
+
+ ftype = build_function_type_list (void_type_node, pvtype, NULL);
+ tm_define_builtin ("__builtin__ITM_LM256", ftype,
+ BUILT_IN_TM_LOG_M256, attrs_log, attrs_type_log);
+ }
+}
+
/* Call this function after instantiating all builtins that the language
front end cares about. This will build the rest of the builtins
and internal functions that are relied upon by the tree optimizers and
@@ -10568,6 +10705,7 @@ build_common_builtin_nodes (void)
}
}
+ build_tm_vector_builtins ();
init_internal_fns ();
}