2020-01-03 Jakub Jelinek <jakub@redhat.com>
+ PR target/93089
+ * config/i386/i386.opt (x_prefer_vector_width_type): Remove TargetSave
+ entry.
+ (mprefer-vector-width=): Add Save.
+ * config/i386/i386-options.c (ix86_target_string): Add PVW argument, print
+ -mprefer-vector-width= if non-zero. Fix up -mfpmath= comment.
+ (ix86_debug_options, ix86_function_specific_print): Adjust
+ ix86_target_string callers.
+ (ix86_valid_target_attribute_inner_p): Handle prefer-vector-width=.
+ (ix86_valid_target_attribute_tree): Likewise.
+ * config/i386/i386-options.h (ix86_target_string): Add PVW argument.
+ * config/i386/i386-expand.c (ix86_expand_builtin): Adjust
+ ix86_target_string caller.
+
PR target/93110
* config/i386/i386.md (abs<mode>2): Use expand_simple_binop instead of
emitting ASHIFTRT, XOR and MINUS by hand. Use gen_int_mode with QImode
ix86_target_string (HOST_WIDE_INT isa, HOST_WIDE_INT isa2,
int flags, int flags2,
const char *arch, const char *tune,
- enum fpmath_unit fpmath, bool add_nl_p, bool add_abi_p)
+ enum fpmath_unit fpmath,
+ enum prefer_vector_width pvw,
+ bool add_nl_p, bool add_abi_p)
{
/* Flag options. */
static struct ix86_target_opts flag_opts[] =
sprintf (flags2_other, "(other flags2: %#x)", flags2);
}
- /* Add -fpmath= option. */
+ /* Add -mfpmath= option. */
if (fpmath)
{
opts[num][0] = "-mfpmath=";
}
}
+ /* Add -mprefer-vector-width= option. */
+ if (pvw)
+ {
+ opts[num][0] = "-mprefer-vector-width=";
+ switch ((int) pvw)
+ {
+ case PVW_AVX128:
+ opts[num++][1] = "128";
+ break;
+
+ case PVW_AVX256:
+ opts[num++][1] = "256";
+ break;
+
+ case PVW_AVX512:
+ opts[num++][1] = "512";
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
/* Any options? */
if (num == 0)
return NULL;
{
char *opts = ix86_target_string (ix86_isa_flags, ix86_isa_flags2,
target_flags, ix86_target_flags,
- ix86_arch_string,ix86_tune_string,
- ix86_fpmath, true, true);
+ ix86_arch_string, ix86_tune_string,
+ ix86_fpmath, prefer_vector_width_type,
+ true, true);
if (opts)
{
char *target_string
= ix86_target_string (ptr->x_ix86_isa_flags, ptr->x_ix86_isa_flags2,
ptr->x_target_flags, ptr->x_ix86_target_flags,
- NULL, NULL, ptr->x_ix86_fpmath, false, true);
+ NULL, NULL, ptr->x_ix86_fpmath,
+ ptr->x_prefer_vector_width_type, false, true);
gcc_assert (ptr->arch < PROCESSOR_max);
fprintf (file, "%*sarch = %d (%s)\n",
/* enum options */
IX86_ATTR_ENUM ("fpmath=", OPT_mfpmath_),
+ IX86_ATTR_ENUM ("prefer-vector-width=", OPT_mprefer_vector_width_),
/* string options */
IX86_ATTR_STR ("arch=", IX86_FUNCTION_SPECIFIC_ARCH),
const char *orig_arch_string = opts->x_ix86_arch_string;
const char *orig_tune_string = opts->x_ix86_tune_string;
enum fpmath_unit orig_fpmath_set = opts_set->x_ix86_fpmath;
+ enum prefer_vector_width orig_pvw_set = opts_set->x_prefer_vector_width_type;
int orig_tune_defaulted = ix86_tune_defaulted;
int orig_arch_specified = ix86_arch_specified;
char *option_strings[IX86_FUNCTION_SPECIFIC_MAX] = { NULL, NULL };
|| opts->x_target_flags != def->x_target_flags
|| option_strings[IX86_FUNCTION_SPECIFIC_ARCH]
|| option_strings[IX86_FUNCTION_SPECIFIC_TUNE]
- || enum_opts_set.x_ix86_fpmath)
+ || enum_opts_set.x_ix86_fpmath
+ || enum_opts_set.x_prefer_vector_width_type)
{
/* If we are using the default tune= or arch=, undo the string assigned,
and use the default. */
/* If fpmath= is not set, and we now have sse2 on 32-bit, use it. */
if (enum_opts_set.x_ix86_fpmath)
opts_set->x_ix86_fpmath = (enum fpmath_unit) 1;
+ if (enum_opts_set.x_prefer_vector_width_type)
+ opts_set->x_prefer_vector_width_type = (enum prefer_vector_width) 1;
/* Do any overrides, such as arch=xxx, or tune=xxx support. */
bool r = ix86_option_override_internal (false, opts, opts_set);
opts->x_ix86_arch_string = orig_arch_string;
opts->x_ix86_tune_string = orig_tune_string;
opts_set->x_ix86_fpmath = orig_fpmath_set;
+ opts_set->x_prefer_vector_width_type = orig_pvw_set;
release_options_strings (option_strings);
}