"__builtin_aarch64_simd_udi");
}
-/* Return a set of FLAG_* flags that describe what the function could do,
+/* Return a set of FLAG_* flags derived from FLAGS
+ that describe what a function with result MODE could do,
taking the command-line flags into account. */
static unsigned int
-aarch64_call_properties (aarch64_simd_builtin_datum *d)
+aarch64_call_properties (unsigned int flags, machine_mode mode)
{
- unsigned int flags = d->flags;
-
- if (!(flags & FLAG_AUTO_FP) && FLOAT_MODE_P (d->mode))
+ if (!(flags & FLAG_AUTO_FP) && FLOAT_MODE_P (mode))
flags |= FLAG_FP;
/* -fno-trapping-math means that we can assume any FP exceptions
return flags;
}
-/* Return true if calls to the function could modify some form of
- global state. */
+/* Return true if calls to a function with flags F and mode MODE
+ could modify some form of global state. */
static bool
-aarch64_modifies_global_state_p (aarch64_simd_builtin_datum *d)
+aarch64_modifies_global_state_p (unsigned int f, machine_mode mode)
{
- unsigned int flags = aarch64_call_properties (d);
+ unsigned int flags = aarch64_call_properties (f, mode);
if (flags & FLAG_RAISE_FP_EXCEPTIONS)
return true;
return flags & FLAG_WRITE_MEMORY;
}
-/* Return true if calls to the function could read some form of
- global state. */
+/* Return true if calls to a function with flags F and mode MODE
+ could read some form of global state. */
static bool
-aarch64_reads_global_state_p (aarch64_simd_builtin_datum *d)
+aarch64_reads_global_state_p (unsigned int f, machine_mode mode)
{
- unsigned int flags = aarch64_call_properties (d);
+ unsigned int flags = aarch64_call_properties (f, mode);
if (flags & FLAG_READ_FPCR)
return true;
return flags & FLAG_READ_MEMORY;
}
-/* Return true if calls to the function could raise a signal. */
+/* Return true if calls to a function with flags F and mode MODE
+ could raise a signal. */
static bool
-aarch64_could_trap_p (aarch64_simd_builtin_datum *d)
+aarch64_could_trap_p (unsigned int f, machine_mode mode)
{
- unsigned int flags = aarch64_call_properties (d);
+ unsigned int flags = aarch64_call_properties (f, mode);
if (flags & FLAG_RAISE_FP_EXCEPTIONS)
return true;
return tree_cons (get_identifier (name), NULL_TREE, attrs);
}
-/* Return the appropriate function attributes. */
+/* Return the appropriate attributes for a function that has
+ flags F and mode MODE. */
static tree
-aarch64_get_attributes (aarch64_simd_builtin_datum *d)
+aarch64_get_attributes (unsigned int f, machine_mode mode)
{
tree attrs = NULL_TREE;
- if (!aarch64_modifies_global_state_p (d))
+ if (!aarch64_modifies_global_state_p (f, mode))
{
- if (aarch64_reads_global_state_p (d))
+ if (aarch64_reads_global_state_p (f, mode))
attrs = aarch64_add_attribute ("pure", attrs);
else
attrs = aarch64_add_attribute ("const", attrs);
}
- if (!flag_non_call_exceptions || !aarch64_could_trap_p (d))
+ if (!flag_non_call_exceptions || !aarch64_could_trap_p (f, mode))
attrs = aarch64_add_attribute ("nothrow", attrs);
return aarch64_add_attribute ("leaf", attrs);
= aarch64_simd_builtin_std_type (SImode, qualifier_lane_pair_index);
tree ftype = build_function_type_list (argtype, argtype, argtype,
quadtype, lanetype, NULL_TREE);
- tree fndecl = aarch64_general_add_builtin (d->name, ftype, d->fcode);
+ tree attrs = aarch64_get_attributes (FLAG_FP, d->mode);
+ tree fndecl
+ = aarch64_general_add_builtin (d->name, ftype, d->fcode, attrs);
aarch64_builtin_decls[d->fcode] = fndecl;
}
snprintf (namebuf, sizeof (namebuf), "__builtin_aarch64_%s",
d->name);
- tree attrs = aarch64_get_attributes (d);
+ tree attrs = aarch64_get_attributes (d->flags, d->mode);
fndecl = aarch64_general_add_builtin (namebuf, ftype, fcode, attrs);
aarch64_builtin_decls[fcode] = fndecl;
tree argtype = aarch64_simd_builtin_std_type (d->mode,
qualifier_unsigned);
tree ftype = build_function_type_list (usi_type, usi_type, argtype, NULL_TREE);
- tree fndecl = aarch64_general_add_builtin (d->name, ftype, d->fcode);
+ tree attrs = aarch64_get_attributes (FLAG_NONE, d->mode);
+ tree fndecl
+ = aarch64_general_add_builtin (d->name, ftype, d->fcode, attrs);
aarch64_builtin_decls[d->fcode] = fndecl;
}
for (; bdd < bdd_end; bdd++)
{
ftype = build_function_type_list (bdd->type_node, bdd->type_node, NULL_TREE);
+ tree attrs = aarch64_get_attributes (FLAG_FP, TYPE_MODE (bdd->type_node));
fndecl = aarch64_general_add_builtin (bdd->builtin_name,
- ftype, bdd->function_code);
+ ftype, bdd->function_code, attrs);
aarch64_builtin_decls[bdd->function_code] = fndecl;
}
}