* PING: PATCH: Use int64 for x86 options
@ 2011-08-06 16:05 H.J. Lu
2011-08-08 2:18 ` H.J. Lu
0 siblings, 1 reply; 11+ messages in thread
From: H.J. Lu @ 2011-08-06 16:05 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc
Ping. AVX2 support depends on this patch.
Thanks.
On Thu, Aug 4, 2011 at 5:49 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Aug 4, 2011 at 4:44 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Thu, Aug 4, 2011 at 3:46 PM, Joseph S. Myers <joseph@codesourcery.com> wrote:
>>> On Thu, 4 Aug 2011, H.J. Lu wrote:
>>>
>>>> Here is the updated patch to get proper HOST_WIDE_INT bits and 1
>>>> through a new file, opt-gen.c. OK for trunk?
>>>
>>> Using another generator program like this can't be the best approach
>>> (apart from anything else, when built for the build system hwint.h should
>>> reflect the build system types not the host system types; cf.
>>> <http://gcc.gnu.org/ml/gcc/2010-08/msg00111.html> where I suspected that
>>> sort of host/build confusion of causing a reported build failure).
>>>
>>> You want opth-gen.awk to know the number of bits to give errors. Note
>>> that the errors are given by generating #error into the output file. It's
>>> easy enough to generate #if conditions into the file that compare with
>>> HOST_BITS_PER_WIDE_INT.
>>>
>>> You want opth-gen.awk to know whether to use 1LL as the shifted constant.
>>> You can easily enough make hwint.h contain a HOST_WIDE_INT_1 macro,
>>> defined to 1L or 1LL as appropriate.
>>>
>>
>>
>> Here is the updated patch. OK for trunk?
>>
>
> Small update. Replace 1LL with HOST_WIDE_INT_1 in PTA_XXX.
> OK for trunk?
>
> Thanks.
>
> --
> H.J.
> ---
> 2011-08-04 H.J. Lu <hongjiu.lu@intel.com>
> Igor Zamyatin <igor.zamyatin@intel.com>
>
> * hwint.h (HOST_WIDE_INT_1): New.
>
> * opt-functions.awk (switch_bit_fields): Initialize the
> host_wide_int field.
> (host_wide_int_var_name): New.
> (var_type_struct): Check and return HOST_WIDE_INT.
>
> * opt-read.awk: Handle HOST_WIDE_INT for "Variable".
>
> * optc-save-gen.awk: Support HOST_WIDE_INT on var_target_other.
>
> * opth-gen.awk: Use HOST_WIDE_INT_1 on HOST_WIDE_INT. Properly
> check masks for HOST_WIDE_INT.
>
> * opts-common.c (set_option): Support HOST_WIDE_INT Flag_var.
>
> * opts.h (cl_option): Add cl_host_wide_int. Change var_value
> to HOST_WIDE_INT.
>
> * config/i386/i386-c.c (ix86_target_macros_internal): Replace int
> with HOST_WIDE_INT for isa_flag.
> (ix86_pragma_target_parse): Replace int with HOST_WIDE_INT for
> isa variables.
>
> * config/i386/i386.c (ix86_target_string): Replace int with
> HOST_WIDE_INT for isa. Use HOST_WIDE_INT_PRINT to print isa.
> (ix86_target_opts): Replace int with HOST_WIDE_INT on mask.
> (pta_flags): Removed.
> (PTA_XXX): Redefined as (HOST_WIDE_INT_1 << X).
> (pta): Use HOST_WIDE_INT on flags.
> (builtin_isa): Use HOST_WIDE_INT on isa.
> (ix86_add_new_builtins): Likewise.
> (def_builtin): Use HOST_WIDE_INT on mask.
> (def_builtin_const): Likewise.
> (builtin_description): Likewise.
>
> * config/i386/i386.opt (ix86_isa_flags): Replace int with
> HOST_WIDE_INT.
> (ix86_isa_flags_explicit): Likewise.
> (x_ix86_isa_flags_explicit): Likewise.
>
--
H.J.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: PING: PATCH: Use int64 for x86 options 2011-08-06 16:05 PING: PATCH: Use int64 for x86 options H.J. Lu @ 2011-08-08 2:18 ` H.J. Lu 2011-08-09 13:32 ` H.J. Lu 2011-08-17 19:28 ` Joseph S. Myers 0 siblings, 2 replies; 11+ messages in thread From: H.J. Lu @ 2011-08-08 2:18 UTC (permalink / raw) To: Joseph S. Myers; +Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc [-- Attachment #1: Type: text/plain, Size: 3612 bytes --] On Sat, Aug 6, 2011 at 9:05 AM, H.J. Lu <hjl.tools@gmail.com> wrote: > Ping. AVX2 support depends on this patch. > > Thanks. > > On Thu, Aug 4, 2011 at 5:49 PM, H.J. Lu <hjl.tools@gmail.com> wrote: >> On Thu, Aug 4, 2011 at 4:44 PM, H.J. Lu <hjl.tools@gmail.com> wrote: >>> On Thu, Aug 4, 2011 at 3:46 PM, Joseph S. Myers <joseph@codesourcery.com> wrote: >>>> On Thu, 4 Aug 2011, H.J. Lu wrote: >>>> >>>>> Here is the updated patch to get proper HOST_WIDE_INT bits and 1 >>>>> through a new file, opt-gen.c. OK for trunk? >>>> >>>> Using another generator program like this can't be the best approach >>>> (apart from anything else, when built for the build system hwint.h should >>>> reflect the build system types not the host system types; cf. >>>> <http://gcc.gnu.org/ml/gcc/2010-08/msg00111.html> where I suspected that >>>> sort of host/build confusion of causing a reported build failure). >>>> >>>> You want opth-gen.awk to know the number of bits to give errors. Note >>>> that the errors are given by generating #error into the output file. It's >>>> easy enough to generate #if conditions into the file that compare with >>>> HOST_BITS_PER_WIDE_INT. >>>> >>>> You want opth-gen.awk to know whether to use 1LL as the shifted constant. >>>> You can easily enough make hwint.h contain a HOST_WIDE_INT_1 macro, >>>> defined to 1L or 1LL as appropriate. >>>> >>> >>> >>> Here is the updated patch. OK for trunk? >>> >> >> Small update. Replace 1LL with HOST_WIDE_INT_1 in PTA_XXX. >> OK for trunk? >> >> Thanks. >> >> -- >> H.J. >> --- >> 2011-08-04 H.J. Lu <hongjiu.lu@intel.com> >> Igor Zamyatin <igor.zamyatin@intel.com> >> >> * hwint.h (HOST_WIDE_INT_1): New. >> >> * opt-functions.awk (switch_bit_fields): Initialize the >> host_wide_int field. >> (host_wide_int_var_name): New. >> (var_type_struct): Check and return HOST_WIDE_INT. >> >> * opt-read.awk: Handle HOST_WIDE_INT for "Variable". >> >> * optc-save-gen.awk: Support HOST_WIDE_INT on var_target_other. >> >> * opth-gen.awk: Use HOST_WIDE_INT_1 on HOST_WIDE_INT. Properly >> check masks for HOST_WIDE_INT. >> >> * opts-common.c (set_option): Support HOST_WIDE_INT Flag_var. >> >> * opts.h (cl_option): Add cl_host_wide_int. Change var_value >> to HOST_WIDE_INT. >> >> * config/i386/i386-c.c (ix86_target_macros_internal): Replace int >> with HOST_WIDE_INT for isa_flag. >> (ix86_pragma_target_parse): Replace int with HOST_WIDE_INT for >> isa variables. >> >> * config/i386/i386.c (ix86_target_string): Replace int with >> HOST_WIDE_INT for isa. Use HOST_WIDE_INT_PRINT to print isa. >> (ix86_target_opts): Replace int with HOST_WIDE_INT on mask. >> (pta_flags): Removed. >> (PTA_XXX): Redefined as (HOST_WIDE_INT_1 << X). >> (pta): Use HOST_WIDE_INT on flags. >> (builtin_isa): Use HOST_WIDE_INT on isa. >> (ix86_add_new_builtins): Likewise. >> (def_builtin): Use HOST_WIDE_INT on mask. >> (def_builtin_const): Likewise. >> (builtin_description): Likewise. >> >> * config/i386/i386.opt (ix86_isa_flags): Replace int with >> HOST_WIDE_INT. >> (ix86_isa_flags_explicit): Likewise. >> (x_ix86_isa_flags_explicit): Likewise. >> > > > > -- > H.J. > HOST_BITS_PER_WIDE_INT isn't defined in target library. I need to check if HOST_BITS_PER_WIDE_INT is defined first. Here is the updated patch. -- H.J. [-- Attachment #2: gcc-x86-int64-7.patch --] [-- Type: text/plain, Size: 16904 bytes --] 2011-08-07 H.J. Lu <hongjiu.lu@intel.com> Igor Zamyatin <igor.zamyatin@intel.com> * hwint.h (HOST_WIDE_INT_1): New. * opt-functions.awk (switch_bit_fields): Initialize the host_wide_int field. (host_wide_int_var_name): New. (var_type_struct): Check and return HOST_WIDE_INT. * opt-read.awk: Handle HOST_WIDE_INT for "Variable". * optc-save-gen.awk: Support HOST_WIDE_INT on var_target_other. * opth-gen.awk: Use HOST_WIDE_INT_1 on HOST_WIDE_INT. Properly check masks for HOST_WIDE_INT. * opts-common.c (set_option): Support HOST_WIDE_INT Flag_var. * opts.h (cl_option): Add cl_host_wide_int. Change var_value to HOST_WIDE_INT. * config/i386/i386-c.c (ix86_target_macros_internal): Replace int with HOST_WIDE_INT for isa_flag. (ix86_pragma_target_parse): Replace int with HOST_WIDE_INT for isa variables. * config/i386/i386.c (ix86_target_string): Replace int with HOST_WIDE_INT for isa. Use HOST_WIDE_INT_PRINT to print isa. (ix86_target_opts): Replace int with HOST_WIDE_INT on mask. (pta_flags): Removed. (PTA_XXX): Redefined as (HOST_WIDE_INT_1 << X). (pta): Use HOST_WIDE_INT on flags. (builtin_isa): Use HOST_WIDE_INT on isa. (ix86_add_new_builtins): Likewise. (def_builtin): Use HOST_WIDE_INT on mask. (def_builtin_const): Likewise. (builtin_description): Likewise. * config/i386/i386.opt (ix86_isa_flags): Replace int with HOST_WIDE_INT. (ix86_isa_flags_explicit): Likewise. (x_ix86_isa_flags_explicit): Likewise. diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c index 1fc333c..c5a770f 100644 --- a/gcc/config/i386/i386-c.c +++ b/gcc/config/i386/i386-c.c @@ -34,14 +34,14 @@ along with GCC; see the file COPYING3. If not see static bool ix86_pragma_target_parse (tree, tree); static void ix86_target_macros_internal - (int, enum processor_type, enum processor_type, enum fpmath_unit, + (HOST_WIDE_INT, enum processor_type, enum processor_type, enum fpmath_unit, void (*def_or_undef) (cpp_reader *, const char *)); \f /* Internal function to either define or undef the appropriate system macros. */ static void -ix86_target_macros_internal (int isa_flag, +ix86_target_macros_internal (HOST_WIDE_INT isa_flag, enum processor_type arch, enum processor_type tune, enum fpmath_unit fpmath, @@ -301,9 +301,9 @@ ix86_pragma_target_parse (tree args, tree pop_target) tree cur_tree; struct cl_target_option *prev_opt; struct cl_target_option *cur_opt; - int prev_isa; - int cur_isa; - int diff_isa; + HOST_WIDE_INT prev_isa; + HOST_WIDE_INT cur_isa; + HOST_WIDE_INT diff_isa; enum processor_type prev_arch; enum processor_type prev_tune; enum processor_type cur_arch; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 19dd243..2af748e 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2500,7 +2500,7 @@ static int ix86_function_regparm (const_tree, const_tree); static void ix86_compute_frame_layout (struct ix86_frame *); static bool ix86_expand_vector_init_one_nonzero (bool, enum machine_mode, rtx, rtx, int); -static void ix86_add_new_builtins (int); +static void ix86_add_new_builtins (HOST_WIDE_INT); static rtx ix86_expand_vec_perm_builtin (tree); static tree ix86_canonical_va_list_type (tree); static void predict_jump (int); @@ -2514,8 +2514,8 @@ enum ix86_function_specific_strings IX86_FUNCTION_SPECIFIC_MAX }; -static char *ix86_target_string (int, int, const char *, const char *, - enum fpmath_unit, bool); +static char *ix86_target_string (HOST_WIDE_INT, int, const char *, + const char *, enum fpmath_unit, bool); static void ix86_debug_options (void) ATTRIBUTE_UNUSED; static void ix86_function_specific_save (struct cl_target_option *); static void ix86_function_specific_restore (struct cl_target_option *); @@ -2633,13 +2633,14 @@ ix86_using_red_zone (void) responsible for freeing the string. */ static char * -ix86_target_string (int isa, int flags, const char *arch, const char *tune, - enum fpmath_unit fpmath, bool add_nl_p) +ix86_target_string (HOST_WIDE_INT isa, int flags, const char *arch, + const char *tune, enum fpmath_unit fpmath, + bool add_nl_p) { struct ix86_target_opts { const char *option; /* option string */ - int mask; /* isa mask options */ + HOST_WIDE_INT mask; /* isa mask options */ }; /* This table is ordered so that options like -msse4.2 that imply @@ -2747,7 +2748,8 @@ ix86_target_string (int isa, int flags, const char *arch, const char *tune, if (isa && add_nl_p) { opts[num++][0] = isa_other; - sprintf (isa_other, "(other isa: %#x)", isa); + sprintf (isa_other, "(other isa: %#" HOST_WIDE_INT_PRINT "x)", + isa); } /* Add flag options. */ @@ -2888,47 +2890,44 @@ ix86_option_override_internal (bool main_args_p) const char *suffix; const char *sw; - enum pta_flags - { - PTA_SSE = 1 << 0, - PTA_SSE2 = 1 << 1, - PTA_SSE3 = 1 << 2, - PTA_MMX = 1 << 3, - PTA_PREFETCH_SSE = 1 << 4, - PTA_3DNOW = 1 << 5, - PTA_3DNOW_A = 1 << 6, - PTA_64BIT = 1 << 7, - PTA_SSSE3 = 1 << 8, - PTA_CX16 = 1 << 9, - PTA_POPCNT = 1 << 10, - PTA_ABM = 1 << 11, - PTA_SSE4A = 1 << 12, - PTA_NO_SAHF = 1 << 13, - PTA_SSE4_1 = 1 << 14, - PTA_SSE4_2 = 1 << 15, - PTA_AES = 1 << 16, - PTA_PCLMUL = 1 << 17, - PTA_AVX = 1 << 18, - PTA_FMA = 1 << 19, - PTA_MOVBE = 1 << 20, - PTA_FMA4 = 1 << 21, - PTA_XOP = 1 << 22, - PTA_LWP = 1 << 23, - PTA_FSGSBASE = 1 << 24, - PTA_RDRND = 1 << 25, - PTA_F16C = 1 << 26, - PTA_BMI = 1 << 27, - PTA_TBM = 1 << 28, - PTA_LZCNT = 1 << 29 - /* if this reaches 32, need to widen struct pta flags below */ - }; +#define PTA_3DNOW (HOST_WIDE_INT_1 << 0) +#define PTA_3DNOW_A (HOST_WIDE_INT_1 << 1) +#define PTA_64BIT (HOST_WIDE_INT_1 << 2) +#define PTA_ABM (HOST_WIDE_INT_1 << 3) +#define PTA_AES (HOST_WIDE_INT_1 << 4) +#define PTA_AVX (HOST_WIDE_INT_1 << 5) +#define PTA_BMI (HOST_WIDE_INT_1 << 6) +#define PTA_CX16 (HOST_WIDE_INT_1 << 7) +#define PTA_F16C (HOST_WIDE_INT_1 << 8) +#define PTA_FMA (HOST_WIDE_INT_1 << 9) +#define PTA_FMA4 (HOST_WIDE_INT_1 << 10) +#define PTA_FSGSBASE (HOST_WIDE_INT_1 << 11) +#define PTA_LWP (HOST_WIDE_INT_1 << 12) +#define PTA_LZCNT (HOST_WIDE_INT_1 << 13) +#define PTA_MMX (HOST_WIDE_INT_1 << 14) +#define PTA_MOVBE (HOST_WIDE_INT_1 << 15) +#define PTA_NO_SAHF (HOST_WIDE_INT_1 << 16) +#define PTA_PCLMUL (HOST_WIDE_INT_1 << 17) +#define PTA_POPCNT (HOST_WIDE_INT_1 << 18) +#define PTA_PREFETCH_SSE (HOST_WIDE_INT_1 << 19) +#define PTA_RDRND (HOST_WIDE_INT_1 << 20) +#define PTA_SSE (HOST_WIDE_INT_1 << 21) +#define PTA_SSE2 (HOST_WIDE_INT_1 << 22) +#define PTA_SSE3 (HOST_WIDE_INT_1 << 23) +#define PTA_SSE4_1 (HOST_WIDE_INT_1 << 24) +#define PTA_SSE4_2 (HOST_WIDE_INT_1 << 25) +#define PTA_SSE4A (HOST_WIDE_INT_1 << 26) +#define PTA_SSSE3 (HOST_WIDE_INT_1 << 27) +#define PTA_TBM (HOST_WIDE_INT_1 << 28) +#define PTA_XOP (HOST_WIDE_INT_1 << 29) +/* if this reaches 64, need to widen struct pta flags below */ static struct pta { const char *const name; /* processor name or nickname. */ const enum processor_type processor; const enum attr_cpu schedule; - const unsigned /*enum pta_flags*/ flags; + const unsigned HOST_WIDE_INT flags; } const processor_alias_table[] = { @@ -24067,7 +24066,7 @@ static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX]; struct builtin_isa { const char *name; /* function name */ enum ix86_builtin_func_type tcode; /* type to use in the declaration */ - int isa; /* isa_flags this builtin is defined for */ + HOST_WIDE_INT isa; /* isa_flags this builtin is defined for */ bool const_p; /* true if the declaration is constant */ bool set_and_not_built_p; }; @@ -24092,7 +24091,8 @@ static struct builtin_isa ix86_builtins_isa[(int) IX86_BUILTIN_MAX]; errors if a builtin is added in the middle of a function scope. */ static inline tree -def_builtin (int mask, const char *name, enum ix86_builtin_func_type tcode, +def_builtin (HOST_WIDE_INT mask, const char *name, + enum ix86_builtin_func_type tcode, enum ix86_builtins code) { tree decl = NULL_TREE; @@ -24130,7 +24130,7 @@ def_builtin (int mask, const char *name, enum ix86_builtin_func_type tcode, /* Like def_builtin, but also marks the function decl "const". */ static inline tree -def_builtin_const (int mask, const char *name, +def_builtin_const (HOST_WIDE_INT mask, const char *name, enum ix86_builtin_func_type tcode, enum ix86_builtins code) { tree decl = def_builtin (mask, name, tcode, code); @@ -24147,7 +24147,7 @@ def_builtin_const (int mask, const char *name, declarations to the tree, even if we didn't use them. */ static void -ix86_add_new_builtins (int isa) +ix86_add_new_builtins (HOST_WIDE_INT isa) { int i; @@ -24181,7 +24181,7 @@ ix86_add_new_builtins (int isa) struct builtin_description { - const unsigned int mask; + const HOST_WIDE_INT mask; const enum insn_code icode; const char *const name; const enum ix86_builtins code; diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt index f197dd8..654f4eb 100644 --- a/gcc/config/i386/i386.opt +++ b/gcc/config/i386/i386.opt @@ -24,12 +24,12 @@ config/i386/i386-opts.h ; Bit flags that specify the ISA we are compiling for. Variable -int ix86_isa_flags = TARGET_64BIT_DEFAULT | TARGET_SUBTARGET_ISA_DEFAULT +HOST_WIDE_INT ix86_isa_flags = TARGET_64BIT_DEFAULT | TARGET_SUBTARGET_ISA_DEFAULT ; A mask of ix86_isa_flags that includes bit X if X was set or cleared ; on the command line. Variable -int ix86_isa_flags_explicit +HOST_WIDE_INT ix86_isa_flags_explicit ;; Definitions to add to the cl_target_option structure ;; -march= processor @@ -50,7 +50,7 @@ unsigned char branch_cost ;; which flags were passed by the user TargetSave -int x_ix86_isa_flags_explicit +HOST_WIDE_INT x_ix86_isa_flags_explicit ;; which flags were passed by the user TargetSave diff --git a/gcc/hwint.h b/gcc/hwint.h index fa77b11..6135136 100644 --- a/gcc/hwint.h +++ b/gcc/hwint.h @@ -79,6 +79,7 @@ extern char sizeof_long_long_must_be_8[sizeof(long long) == 8 ? 1 : -1]; #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG # define HOST_WIDE_INT_PRINT HOST_LONG_FORMAT # define HOST_WIDE_INT_PRINT_C "L" +# define HOST_WIDE_INT_1 1L /* 'long' might be 32 or 64 bits, and the number of leading zeroes must be tweaked accordingly. */ # if HOST_BITS_PER_WIDE_INT == 64 @@ -91,6 +92,7 @@ extern char sizeof_long_long_must_be_8[sizeof(long long) == 8 ? 1 : -1]; #else # define HOST_WIDE_INT_PRINT HOST_LONG_LONG_FORMAT # define HOST_WIDE_INT_PRINT_C "LL" +# define HOST_WIDE_INT_1 1LL /* We can assume that 'long long' is at least 64 bits. */ # define HOST_WIDE_INT_PRINT_DOUBLE_HEX \ "0x%" HOST_LONG_LONG_FORMAT "x%016" HOST_LONG_LONG_FORMAT "x" diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index 945eeb1..1f582fb 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -110,6 +110,11 @@ function switch_flags (flags) # Return bit-field initializers for option flags FLAGS. function switch_bit_fields (flags) { + vn = var_name(flags); + if (host_wide_int[vn] == "yes") + hwi = "Host_Wide_Int" + else + hwi = "" result = "" sep_args = opt_args("Args", flags) if (sep_args == "") @@ -126,6 +131,7 @@ function switch_bit_fields (flags) flag_init("RejectNegative", flags) \ flag_init("JoinedOrMissing", flags) \ flag_init("UInteger", flags) \ + flag_init("Host_Wide_Int", hwi) \ flag_init("ToLower", flags) \ flag_init("Report", flags) @@ -140,6 +146,17 @@ function var_name(flags) return nth_arg(0, opt_args("Var", flags)) } +# Return the name of the variable if FLAGS has a HOST_WIDE_INT variable. +# Return the empty string otherwise. +function host_wide_int_var_name(flags) +{ + split (flags, array, "[ \t]+") + if (array[1] == "HOST_WIDE_INT") + return array[2] + else + return "" +} + # Return true if the option described by FLAGS has a globally-visible state. function global_state_p(flags) { @@ -197,8 +214,12 @@ function var_type_struct(flags) return enum_type[en] " " } else if (!flag_set_p("Joined.*", flags) && !flag_set_p("Separate", flags)) { - if (flag_set_p(".*Mask.*", flags)) - return "int " + if (flag_set_p(".*Mask.*", flags)) { + if (host_wide_int[var_name(flags)] == "yes") + return "HOST_WIDE_INT " + else + return "int " + } else return "signed char " } diff --git a/gcc/opt-read.awk b/gcc/opt-read.awk index c488ed5..6a4d4de 100644 --- a/gcc/opt-read.awk +++ b/gcc/opt-read.awk @@ -51,6 +51,9 @@ BEGIN { else if ($1 == "Variable") { extra_vars[n_extra_vars] = $2 n_extra_vars++ + name = host_wide_int_var_name($2) + if (name != "") + host_wide_int[name] = "yes" } else if ($1 == "TargetVariable") { # Combination of TargetSave and Variable diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk index 4efc115..654d869 100644 --- a/gcc/optc-save-gen.awk +++ b/gcc/optc-save-gen.awk @@ -363,10 +363,16 @@ print "{"; print " fputs (\"\\n\", file);"; for (i = 0; i < n_target_other; i++) { print " if (ptr->x_" var_target_other[i] ")"; - print " fprintf (file, \"%*s%s (%#lx)\\n\","; + if (host_wide_int[var_target_other[i]] == "yes") + print " fprintf (file, \"%*s%s (%#\" HOST_WIDE_INT_PRINT \"x)\\n\","; + else + print " fprintf (file, \"%*s%s (%#x)\\n\","; print " indent, \"\","; print " \"" var_target_other[i] "\","; - print " (unsigned long)ptr->x_" var_target_other[i] ");"; + if (host_wide_int[var_target_other[i]] == "yes") + print " ptr->x_" var_target_other[i] ");"; + else + print " (unsigned long)ptr->x_" var_target_other[i] ");"; print ""; } diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index 876e0f6..2bae695 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -300,18 +300,26 @@ for (i = 0; i < n_opts; i++) { name = opt_args("Mask", flags[i]) vname = var_name(flags[i]) mask = "MASK_" + mask_1 = "1" if (vname != "") { mask = "OPTION_MASK_" + if (host_wide_int[vname] == "yes") + mask_1 = "HOST_WIDE_INT_1" } if (name != "" && !flag_set_p("MaskExists", flags[i])) - print "#define " mask name " (1 << " masknum[vname]++ ")" + print "#define " mask name " (" mask_1 " << " masknum[vname]++ ")" } for (i = 0; i < n_extra_masks; i++) { print "#define MASK_" extra_masks[i] " (1 << " masknum[""]++ ")" } for (var in masknum) { - if (masknum[var] > 31) { + if (var != "" && host_wide_int[var] == "yes") { + print" #if defined(HOST_BITS_PER_WIDE_INT) && " masknum[var] " >= HOST_BITS_PER_WIDE_INT" + print "#error too many masks for " var + print "#endif" + } + else if (masknum[var] > 31) { if (var == "") print "#error too many target masks" else diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 973dd7e..1c2138f 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -1098,11 +1098,26 @@ set_option (struct gcc_options *opts, struct gcc_options *opts_set, case CLVC_BIT_CLEAR: case CLVC_BIT_SET: if ((value != 0) == (option->var_type == CLVC_BIT_SET)) - *(int *) flag_var |= option->var_value; + { + if (option->cl_host_wide_int) + *(HOST_WIDE_INT *) flag_var |= option->var_value; + else + *(int *) flag_var |= option->var_value; + } else - *(int *) flag_var &= ~option->var_value; + { + if (option->cl_host_wide_int) + *(HOST_WIDE_INT *) flag_var &= ~option->var_value; + else + *(int *) flag_var &= ~option->var_value; + } if (set_flag_var) - *(int *) set_flag_var |= option->var_value; + { + if (option->cl_host_wide_int) + *(HOST_WIDE_INT *) set_flag_var |= option->var_value; + else + *(int *) set_flag_var |= option->var_value; + } break; case CLVC_STRING: diff --git a/gcc/opts.h b/gcc/opts.h index b070c8f..3c0fe3f 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -96,6 +96,8 @@ struct cl_option BOOL_BITFIELD cl_missing_ok : 1; /* Argument is an integer >=0. */ BOOL_BITFIELD cl_uinteger : 1; + /* Argument is a HOST_WIDE_INT. */ + BOOL_BITFIELD cl_host_wide_int : 1; /* Argument should be converted to lowercase. */ BOOL_BITFIELD cl_tolower : 1; /* Report argument with -fverbose-asm */ @@ -109,7 +111,7 @@ struct cl_option /* How this option's value is determined and sets a field. */ enum cl_var_type var_type; /* Value or bit-mask with which to set a field. */ - int var_value; + HOST_WIDE_INT var_value; }; /* Records that the state of an option consists of SIZE bytes starting ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: PING: PATCH: Use int64 for x86 options 2011-08-08 2:18 ` H.J. Lu @ 2011-08-09 13:32 ` H.J. Lu 2011-08-09 14:07 ` Joseph S. Myers 2011-08-17 19:28 ` Joseph S. Myers 1 sibling, 1 reply; 11+ messages in thread From: H.J. Lu @ 2011-08-09 13:32 UTC (permalink / raw) To: Joseph S. Myers; +Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc Is this OK for trunk? On Sun, Aug 7, 2011 at 7:18 PM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Sat, Aug 6, 2011 at 9:05 AM, H.J. Lu <hjl.tools@gmail.com> wrote: >> Ping. AVX2 support depends on this patch. >> > >>> --- >>> 2011-08-04 H.J. Lu <hongjiu.lu@intel.com> >>> Igor Zamyatin <igor.zamyatin@intel.com> >>> >>> * hwint.h (HOST_WIDE_INT_1): New. >>> >>> * opt-functions.awk (switch_bit_fields): Initialize the >>> host_wide_int field. >>> (host_wide_int_var_name): New. >>> (var_type_struct): Check and return HOST_WIDE_INT. >>> >>> * opt-read.awk: Handle HOST_WIDE_INT for "Variable". >>> >>> * optc-save-gen.awk: Support HOST_WIDE_INT on var_target_other. >>> >>> * opth-gen.awk: Use HOST_WIDE_INT_1 on HOST_WIDE_INT. Properly >>> check masks for HOST_WIDE_INT. >>> >>> * opts-common.c (set_option): Support HOST_WIDE_INT Flag_var. >>> >>> * opts.h (cl_option): Add cl_host_wide_int. Change var_value >>> to HOST_WIDE_INT. >>> >>> * config/i386/i386-c.c (ix86_target_macros_internal): Replace int >>> with HOST_WIDE_INT for isa_flag. >>> (ix86_pragma_target_parse): Replace int with HOST_WIDE_INT for >>> isa variables. >>> >>> * config/i386/i386.c (ix86_target_string): Replace int with >>> HOST_WIDE_INT for isa. Use HOST_WIDE_INT_PRINT to print isa. >>> (ix86_target_opts): Replace int with HOST_WIDE_INT on mask. >>> (pta_flags): Removed. >>> (PTA_XXX): Redefined as (HOST_WIDE_INT_1 << X). >>> (pta): Use HOST_WIDE_INT on flags. >>> (builtin_isa): Use HOST_WIDE_INT on isa. >>> (ix86_add_new_builtins): Likewise. >>> (def_builtin): Use HOST_WIDE_INT on mask. >>> (def_builtin_const): Likewise. >>> (builtin_description): Likewise. >>> >>> * config/i386/i386.opt (ix86_isa_flags): Replace int with >>> HOST_WIDE_INT. >>> (ix86_isa_flags_explicit): Likewise. >>> (x_ix86_isa_flags_explicit): Likewise. >>> >> >> >> >> -- >> H.J. >> > > HOST_BITS_PER_WIDE_INT isn't defined in target library. > I need to check if HOST_BITS_PER_WIDE_INT is defined > first. Here is the updated patch. > > > > -- > H.J. > -- H.J. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: PING: PATCH: Use int64 for x86 options 2011-08-09 13:32 ` H.J. Lu @ 2011-08-09 14:07 ` Joseph S. Myers 2011-08-09 14:22 ` H.J. Lu 2011-08-16 13:09 ` H.J. Lu 0 siblings, 2 replies; 11+ messages in thread From: Joseph S. Myers @ 2011-08-09 14:07 UTC (permalink / raw) To: H.J. Lu; +Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc On Tue, 9 Aug 2011, H.J. Lu wrote: > Is this OK for trunk? No. You don't need to ping so often; I'll look at it in due course once sufficient time has passed since the last posted revision (if a patch keeps getting new versions posted, I consider that evidence that I should wait a while before considering reviewing it because it's likely still to be unstable). -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: PING: PATCH: Use int64 for x86 options 2011-08-09 14:07 ` Joseph S. Myers @ 2011-08-09 14:22 ` H.J. Lu 2011-08-16 13:09 ` H.J. Lu 1 sibling, 0 replies; 11+ messages in thread From: H.J. Lu @ 2011-08-09 14:22 UTC (permalink / raw) To: Joseph S. Myers; +Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc On Tue, Aug 9, 2011 at 7:06 AM, Joseph S. Myers <joseph@codesourcery.com> wrote: > On Tue, 9 Aug 2011, H.J. Lu wrote: > >> Is this OK for trunk? > > No. You don't need to ping so often; I'll look at it in due course once > sufficient time has passed since the last posted revision (if a patch > keeps getting new versions posted, I consider that evidence that I should > wait a while before considering reviewing it because it's likely still to > be unstable). > Thanks. -- H.J. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: PING: PATCH: Use int64 for x86 options 2011-08-09 14:07 ` Joseph S. Myers 2011-08-09 14:22 ` H.J. Lu @ 2011-08-16 13:09 ` H.J. Lu 2011-08-16 13:48 ` Joseph S. Myers 1 sibling, 1 reply; 11+ messages in thread From: H.J. Lu @ 2011-08-16 13:09 UTC (permalink / raw) To: Joseph S. Myers; +Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc On Tue, Aug 9, 2011 at 7:06 AM, Joseph S. Myers <joseph@codesourcery.com> wrote: > On Tue, 9 Aug 2011, H.J. Lu wrote: > >> Is this OK for trunk? > > No. You don't need to ping so often; I'll look at it in due course once > sufficient time has passed since the last posted revision (if a patch > keeps getting new versions posted, I consider that evidence that I should > wait a while before considering reviewing it because it's likely still to > be unstable). > Hi Joseph, Do you have time to review this patch? We have many x86 patches depending on it. Thanks. -- H.J. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: PING: PATCH: Use int64 for x86 options 2011-08-16 13:09 ` H.J. Lu @ 2011-08-16 13:48 ` Joseph S. Myers 0 siblings, 0 replies; 11+ messages in thread From: Joseph S. Myers @ 2011-08-16 13:48 UTC (permalink / raw) To: H.J. Lu; +Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc [-- Attachment #1: Type: TEXT/PLAIN, Size: 735 bytes --] On Tue, 16 Aug 2011, H.J. Lu wrote: > On Tue, Aug 9, 2011 at 7:06 AM, Joseph S. Myers <joseph@codesourcery.com> wrote: > > On Tue, 9 Aug 2011, H.J. Lu wrote: > > > >> Is this OK for trunk? > > > > No. You don't need to ping so often; I'll look at it in due course once > > sufficient time has passed since the last posted revision (if a patch > > keeps getting new versions posted, I consider that evidence that I should > > wait a while before considering reviewing it because it's likely still to > > be unstable). > > > > Hi Joseph, > > Do you have time to review this patch? We have many x86 patches > depending on it. I expect to review it later this week. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: PING: PATCH: Use int64 for x86 options 2011-08-08 2:18 ` H.J. Lu 2011-08-09 13:32 ` H.J. Lu @ 2011-08-17 19:28 ` Joseph S. Myers 2011-08-17 20:27 ` H.J. Lu 1 sibling, 1 reply; 11+ messages in thread From: Joseph S. Myers @ 2011-08-17 19:28 UTC (permalink / raw) To: H.J. Lu; +Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc On Sun, 7 Aug 2011, H.J. Lu wrote: > HOST_BITS_PER_WIDE_INT isn't defined in target library. > I need to check if HOST_BITS_PER_WIDE_INT is defined > first. Here is the updated patch. As I said in <http://gcc.gnu.org/ml/gcc/2011-07/msg00488.html>, you need to check all CLVC_* uses for cases that need updating for HOST_WIDE_INT fields. This patch fails to update option_enabled and get_option_state. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: PING: PATCH: Use int64 for x86 options 2011-08-17 19:28 ` Joseph S. Myers @ 2011-08-17 20:27 ` H.J. Lu 2011-08-17 20:35 ` Joseph S. Myers 0 siblings, 1 reply; 11+ messages in thread From: H.J. Lu @ 2011-08-17 20:27 UTC (permalink / raw) To: Joseph S. Myers; +Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc On Wed, Aug 17, 2011 at 12:28 PM, Joseph S. Myers <joseph@codesourcery.com> wrote: > On Sun, 7 Aug 2011, H.J. Lu wrote: > >> HOST_BITS_PER_WIDE_INT isn't defined in target library. >> I need to check if HOST_BITS_PER_WIDE_INT is defined >> first. Here is the updated patch. > > As I said in <http://gcc.gnu.org/ml/gcc/2011-07/msg00488.html>, you need > to check all CLVC_* uses for cases that need updating for HOST_WIDE_INT > fields. This patch fails to update option_enabled and get_option_state. > Here is the additional patch. Thanks. H.J. --- diff --git a/gcc/ChangeLog.isa b/gcc/ChangeLog.isa index a8f7d0e..fe52888 100644 --- a/gcc/ChangeLog.isa +++ b/gcc/ChangeLog.isa @@ -1,3 +1,15 @@ +2011-08-17 H.J. Lu <hongjiu.lu@intel.com> + + * opts-common.c (get_option_state): Check cl_host_wide_int + for CLVC_EQUAL size. + +2011-08-17 H.J. Lu <hongjiu.lu@intel.com> + + * opts-common.c (set_option): Check cl_host_wide_int for + CLVC_EQUAL. + (option_enabled): Check cl_host_wide_int for CLVC_EQUAL, + CLVC_BIT_CLEAR and CLVC_BIT_SET. + 2011-08-07 H.J. Lu <hongjiu.lu@intel.com> * opth-gen.awk: Check number of mask bits only if diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 1c2138f..0b86764 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -1088,9 +1088,14 @@ set_option (struct gcc_options *opts, struct gcc_options *opts_set, break; case CLVC_EQUAL: - *(int *) flag_var = (value - ? option->var_value - : !option->var_value); + if (option->cl_host_wide_int) + *(HOST_WIDE_INT *) flag_var = (value + ? option->var_value + : !option->var_value); + else + *(int *) flag_var = (value + ? option->var_value + : !option->var_value); if (set_flag_var) *(int *) set_flag_var = 1; break; @@ -1188,13 +1193,22 @@ option_enabled (int opt_idx, void *opts) return *(int *) flag_var != 0; case CLVC_EQUAL: - return *(int *) flag_var == option->var_value; + if (option->cl_host_wide_int) + return *(HOST_WIDE_INT *) flag_var == option->var_value; + else + return *(int *) flag_var == option->var_value; case CLVC_BIT_CLEAR: - return (*(int *) flag_var & option->var_value) == 0; + if (option->cl_host_wide_int) + return (*(HOST_WIDE_INT *) flag_var & option->var_value) == 0; + else + return (*(int *) flag_var & option->var_value) == 0; case CLVC_BIT_SET: - return (*(int *) flag_var & option->var_value) != 0; + if (option->cl_host_wide_int) + return (*(HOST_WIDE_INT *) flag_var & option->var_value) != 0; + else + return (*(int *) flag_var & option->var_value) != 0; case CLVC_STRING: case CLVC_ENUM: @@ -1221,7 +1235,9 @@ get_option_state (struct gcc_options *opts, int option, case CLVC_BOOLEAN: case CLVC_EQUAL: state->data = flag_var; - state->size = sizeof (int); + state->size = (cl_options[option].cl_host_wide_int + ? sizeof (HOST_WIDE_INT) + : sizeof (int)); break; case CLVC_BIT_CLEAR: ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: PING: PATCH: Use int64 for x86 options 2011-08-17 20:27 ` H.J. Lu @ 2011-08-17 20:35 ` Joseph S. Myers 2011-08-17 20:41 ` H.J. Lu 0 siblings, 1 reply; 11+ messages in thread From: Joseph S. Myers @ 2011-08-17 20:35 UTC (permalink / raw) To: H.J. Lu; +Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc [-- Attachment #1: Type: TEXT/PLAIN, Size: 792 bytes --] On Wed, 17 Aug 2011, H.J. Lu wrote: > On Wed, Aug 17, 2011 at 12:28 PM, Joseph S. Myers > <joseph@codesourcery.com> wrote: > > On Sun, 7 Aug 2011, H.J. Lu wrote: > > > >> HOST_BITS_PER_WIDE_INT isn't defined in target library. > >> I need to check if HOST_BITS_PER_WIDE_INT is defined > >> first. Here is the updated patch. > > > > As I said in <http://gcc.gnu.org/ml/gcc/2011-07/msg00488.html>, you need > > to check all CLVC_* uses for cases that need updating for HOST_WIDE_INT > > fields. This patch fails to update option_enabled and get_option_state. > > > > Here is the additional patch. Thanks. The target-independent parts of your patch are OK with these extra changes, subject to the usual test requirements. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: PING: PATCH: Use int64 for x86 options 2011-08-17 20:35 ` Joseph S. Myers @ 2011-08-17 20:41 ` H.J. Lu 0 siblings, 0 replies; 11+ messages in thread From: H.J. Lu @ 2011-08-17 20:41 UTC (permalink / raw) To: Joseph S. Myers Cc: Ian Lance Taylor, Uros Bizjak, Igor Zamyatin, gcc, Richard Henderson [-- Attachment #1: Type: text/plain, Size: 2594 bytes --] On Wed, Aug 17, 2011 at 1:35 PM, Joseph S. Myers <joseph@codesourcery.com> wrote: > On Wed, 17 Aug 2011, H.J. Lu wrote: > >> On Wed, Aug 17, 2011 at 12:28 PM, Joseph S. Myers >> <joseph@codesourcery.com> wrote: >> > On Sun, 7 Aug 2011, H.J. Lu wrote: >> > >> >> HOST_BITS_PER_WIDE_INT isn't defined in target library. >> >> I need to check if HOST_BITS_PER_WIDE_INT is defined >> >> first. Here is the updated patch. >> > >> > As I said in <http://gcc.gnu.org/ml/gcc/2011-07/msg00488.html>, you need >> > to check all CLVC_* uses for cases that need updating for HOST_WIDE_INT >> > fields. This patch fails to update option_enabled and get_option_state. >> > >> >> Here is the additional patch. > > Thanks. The target-independent parts of your patch are OK with these > extra changes, subject to the usual test requirements. > > -- > Joseph S. Myers > joseph@codesourcery.com I am testing this complete patch. Richard, Uros, is x86 backend change OK? Thanks. -- H.J. ---- 2011-08-17 H.J. Lu <hongjiu.lu@intel.com> Igor Zamyatin <igor.zamyatin@intel.com> * hwint.h (HOST_WIDE_INT_1): New. * opt-functions.awk (switch_bit_fields): Initialize the host_wide_int field. (host_wide_int_var_name): New. (var_type_struct): Check and return HOST_WIDE_INT. * opt-read.awk: Handle HOST_WIDE_INT for "Variable". * optc-save-gen.awk: Support HOST_WIDE_INT on var_target_other. * opth-gen.awk: Use HOST_WIDE_INT_1 on HOST_WIDE_INT. Properly check masks for HOST_WIDE_INT. * opts-common.c (set_option): Support HOST_WIDE_INT flag_var. (option_enabled): Likewise. (get_option_state): Likewise. * opts.h (cl_option): Add cl_host_wide_int. Change var_value to HOST_WIDE_INT. * config/i386/i386-c.c (ix86_target_macros_internal): Replace int with HOST_WIDE_INT for isa_flag. (ix86_pragma_target_parse): Replace int with HOST_WIDE_INT for isa variables. * config/i386/i386.c (ix86_target_string): Replace int with HOST_WIDE_INT for isa. Use HOST_WIDE_INT_PRINT to print isa. (ix86_target_opts): Replace int with HOST_WIDE_INT on mask. (pta_flags): Removed. (PTA_XXX): Redefined as (HOST_WIDE_INT_1 << X). (pta): Use HOST_WIDE_INT on flags. (builtin_isa): Use HOST_WIDE_INT on isa. (ix86_add_new_builtins): Likewise. (def_builtin): Use HOST_WIDE_INT on mask. (def_builtin_const): Likewise. (builtin_description): Likewise. * config/i386/i386.opt (ix86_isa_flags): Replace int with HOST_WIDE_INT. (ix86_isa_flags_explicit): Likewise. (x_ix86_isa_flags_explicit): Likewise. [-- Attachment #2: gcc-x86-int64-8.patch --] [-- Type: text/x-diff, Size: 18692 bytes --] 2011-08-17 H.J. Lu <hongjiu.lu@intel.com> Igor Zamyatin <igor.zamyatin@intel.com> * hwint.h (HOST_WIDE_INT_1): New. * opt-functions.awk (switch_bit_fields): Initialize the host_wide_int field. (host_wide_int_var_name): New. (var_type_struct): Check and return HOST_WIDE_INT. * opt-read.awk: Handle HOST_WIDE_INT for "Variable". * optc-save-gen.awk: Support HOST_WIDE_INT on var_target_other. * opth-gen.awk: Use HOST_WIDE_INT_1 on HOST_WIDE_INT. Properly check masks for HOST_WIDE_INT. * opts-common.c (set_option): Support HOST_WIDE_INT flag_var. (option_enabled): Likewise. (get_option_state): Likewise. * opts.h (cl_option): Add cl_host_wide_int. Change var_value to HOST_WIDE_INT. * config/i386/i386-c.c (ix86_target_macros_internal): Replace int with HOST_WIDE_INT for isa_flag. (ix86_pragma_target_parse): Replace int with HOST_WIDE_INT for isa variables. * config/i386/i386.c (ix86_target_string): Replace int with HOST_WIDE_INT for isa. Use HOST_WIDE_INT_PRINT to print isa. (ix86_target_opts): Replace int with HOST_WIDE_INT on mask. (pta_flags): Removed. (PTA_XXX): Redefined as (HOST_WIDE_INT_1 << X). (pta): Use HOST_WIDE_INT on flags. (builtin_isa): Use HOST_WIDE_INT on isa. (ix86_add_new_builtins): Likewise. (def_builtin): Use HOST_WIDE_INT on mask. (def_builtin_const): Likewise. (builtin_description): Likewise. * config/i386/i386.opt (ix86_isa_flags): Replace int with HOST_WIDE_INT. (ix86_isa_flags_explicit): Likewise. (x_ix86_isa_flags_explicit): Likewise. diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c index 1fc333c..c5a770f 100644 --- a/gcc/config/i386/i386-c.c +++ b/gcc/config/i386/i386-c.c @@ -34,14 +34,14 @@ along with GCC; see the file COPYING3. If not see static bool ix86_pragma_target_parse (tree, tree); static void ix86_target_macros_internal - (int, enum processor_type, enum processor_type, enum fpmath_unit, + (HOST_WIDE_INT, enum processor_type, enum processor_type, enum fpmath_unit, void (*def_or_undef) (cpp_reader *, const char *)); \f /* Internal function to either define or undef the appropriate system macros. */ static void -ix86_target_macros_internal (int isa_flag, +ix86_target_macros_internal (HOST_WIDE_INT isa_flag, enum processor_type arch, enum processor_type tune, enum fpmath_unit fpmath, @@ -301,9 +301,9 @@ ix86_pragma_target_parse (tree args, tree pop_target) tree cur_tree; struct cl_target_option *prev_opt; struct cl_target_option *cur_opt; - int prev_isa; - int cur_isa; - int diff_isa; + HOST_WIDE_INT prev_isa; + HOST_WIDE_INT cur_isa; + HOST_WIDE_INT diff_isa; enum processor_type prev_arch; enum processor_type prev_tune; enum processor_type cur_arch; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index fe6ccbe..308768b 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2500,7 +2500,7 @@ static int ix86_function_regparm (const_tree, const_tree); static void ix86_compute_frame_layout (struct ix86_frame *); static bool ix86_expand_vector_init_one_nonzero (bool, enum machine_mode, rtx, rtx, int); -static void ix86_add_new_builtins (int); +static void ix86_add_new_builtins (HOST_WIDE_INT); static rtx ix86_expand_vec_perm_builtin (tree); static tree ix86_canonical_va_list_type (tree); static void predict_jump (int); @@ -2514,8 +2514,8 @@ enum ix86_function_specific_strings IX86_FUNCTION_SPECIFIC_MAX }; -static char *ix86_target_string (int, int, const char *, const char *, - enum fpmath_unit, bool); +static char *ix86_target_string (HOST_WIDE_INT, int, const char *, + const char *, enum fpmath_unit, bool); static void ix86_debug_options (void) ATTRIBUTE_UNUSED; static void ix86_function_specific_save (struct cl_target_option *); static void ix86_function_specific_restore (struct cl_target_option *); @@ -2633,13 +2633,14 @@ ix86_using_red_zone (void) responsible for freeing the string. */ static char * -ix86_target_string (int isa, int flags, const char *arch, const char *tune, - enum fpmath_unit fpmath, bool add_nl_p) +ix86_target_string (HOST_WIDE_INT isa, int flags, const char *arch, + const char *tune, enum fpmath_unit fpmath, + bool add_nl_p) { struct ix86_target_opts { const char *option; /* option string */ - int mask; /* isa mask options */ + HOST_WIDE_INT mask; /* isa mask options */ }; /* This table is ordered so that options like -msse4.2 that imply @@ -2747,7 +2748,8 @@ ix86_target_string (int isa, int flags, const char *arch, const char *tune, if (isa && add_nl_p) { opts[num++][0] = isa_other; - sprintf (isa_other, "(other isa: %#x)", isa); + sprintf (isa_other, "(other isa: %#" HOST_WIDE_INT_PRINT "x)", + isa); } /* Add flag options. */ @@ -2888,47 +2890,44 @@ ix86_option_override_internal (bool main_args_p) const char *suffix; const char *sw; - enum pta_flags - { - PTA_SSE = 1 << 0, - PTA_SSE2 = 1 << 1, - PTA_SSE3 = 1 << 2, - PTA_MMX = 1 << 3, - PTA_PREFETCH_SSE = 1 << 4, - PTA_3DNOW = 1 << 5, - PTA_3DNOW_A = 1 << 6, - PTA_64BIT = 1 << 7, - PTA_SSSE3 = 1 << 8, - PTA_CX16 = 1 << 9, - PTA_POPCNT = 1 << 10, - PTA_ABM = 1 << 11, - PTA_SSE4A = 1 << 12, - PTA_NO_SAHF = 1 << 13, - PTA_SSE4_1 = 1 << 14, - PTA_SSE4_2 = 1 << 15, - PTA_AES = 1 << 16, - PTA_PCLMUL = 1 << 17, - PTA_AVX = 1 << 18, - PTA_FMA = 1 << 19, - PTA_MOVBE = 1 << 20, - PTA_FMA4 = 1 << 21, - PTA_XOP = 1 << 22, - PTA_LWP = 1 << 23, - PTA_FSGSBASE = 1 << 24, - PTA_RDRND = 1 << 25, - PTA_F16C = 1 << 26, - PTA_BMI = 1 << 27, - PTA_TBM = 1 << 28, - PTA_LZCNT = 1 << 29 - /* if this reaches 32, need to widen struct pta flags below */ - }; +#define PTA_3DNOW (HOST_WIDE_INT_1 << 0) +#define PTA_3DNOW_A (HOST_WIDE_INT_1 << 1) +#define PTA_64BIT (HOST_WIDE_INT_1 << 2) +#define PTA_ABM (HOST_WIDE_INT_1 << 3) +#define PTA_AES (HOST_WIDE_INT_1 << 4) +#define PTA_AVX (HOST_WIDE_INT_1 << 5) +#define PTA_BMI (HOST_WIDE_INT_1 << 6) +#define PTA_CX16 (HOST_WIDE_INT_1 << 7) +#define PTA_F16C (HOST_WIDE_INT_1 << 8) +#define PTA_FMA (HOST_WIDE_INT_1 << 9) +#define PTA_FMA4 (HOST_WIDE_INT_1 << 10) +#define PTA_FSGSBASE (HOST_WIDE_INT_1 << 11) +#define PTA_LWP (HOST_WIDE_INT_1 << 12) +#define PTA_LZCNT (HOST_WIDE_INT_1 << 13) +#define PTA_MMX (HOST_WIDE_INT_1 << 14) +#define PTA_MOVBE (HOST_WIDE_INT_1 << 15) +#define PTA_NO_SAHF (HOST_WIDE_INT_1 << 16) +#define PTA_PCLMUL (HOST_WIDE_INT_1 << 17) +#define PTA_POPCNT (HOST_WIDE_INT_1 << 18) +#define PTA_PREFETCH_SSE (HOST_WIDE_INT_1 << 19) +#define PTA_RDRND (HOST_WIDE_INT_1 << 20) +#define PTA_SSE (HOST_WIDE_INT_1 << 21) +#define PTA_SSE2 (HOST_WIDE_INT_1 << 22) +#define PTA_SSE3 (HOST_WIDE_INT_1 << 23) +#define PTA_SSE4_1 (HOST_WIDE_INT_1 << 24) +#define PTA_SSE4_2 (HOST_WIDE_INT_1 << 25) +#define PTA_SSE4A (HOST_WIDE_INT_1 << 26) +#define PTA_SSSE3 (HOST_WIDE_INT_1 << 27) +#define PTA_TBM (HOST_WIDE_INT_1 << 28) +#define PTA_XOP (HOST_WIDE_INT_1 << 29) +/* if this reaches 64, need to widen struct pta flags below */ static struct pta { const char *const name; /* processor name or nickname. */ const enum processor_type processor; const enum attr_cpu schedule; - const unsigned /*enum pta_flags*/ flags; + const unsigned HOST_WIDE_INT flags; } const processor_alias_table[] = { @@ -24099,7 +24098,7 @@ static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX]; struct builtin_isa { const char *name; /* function name */ enum ix86_builtin_func_type tcode; /* type to use in the declaration */ - int isa; /* isa_flags this builtin is defined for */ + HOST_WIDE_INT isa; /* isa_flags this builtin is defined for */ bool const_p; /* true if the declaration is constant */ bool set_and_not_built_p; }; @@ -24124,7 +24123,8 @@ static struct builtin_isa ix86_builtins_isa[(int) IX86_BUILTIN_MAX]; errors if a builtin is added in the middle of a function scope. */ static inline tree -def_builtin (int mask, const char *name, enum ix86_builtin_func_type tcode, +def_builtin (HOST_WIDE_INT mask, const char *name, + enum ix86_builtin_func_type tcode, enum ix86_builtins code) { tree decl = NULL_TREE; @@ -24162,7 +24162,7 @@ def_builtin (int mask, const char *name, enum ix86_builtin_func_type tcode, /* Like def_builtin, but also marks the function decl "const". */ static inline tree -def_builtin_const (int mask, const char *name, +def_builtin_const (HOST_WIDE_INT mask, const char *name, enum ix86_builtin_func_type tcode, enum ix86_builtins code) { tree decl = def_builtin (mask, name, tcode, code); @@ -24179,7 +24179,7 @@ def_builtin_const (int mask, const char *name, declarations to the tree, even if we didn't use them. */ static void -ix86_add_new_builtins (int isa) +ix86_add_new_builtins (HOST_WIDE_INT isa) { int i; @@ -24213,7 +24213,7 @@ ix86_add_new_builtins (int isa) struct builtin_description { - const unsigned int mask; + const HOST_WIDE_INT mask; const enum insn_code icode; const char *const name; const enum ix86_builtins code; diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt index f197dd8..654f4eb 100644 --- a/gcc/config/i386/i386.opt +++ b/gcc/config/i386/i386.opt @@ -24,12 +24,12 @@ config/i386/i386-opts.h ; Bit flags that specify the ISA we are compiling for. Variable -int ix86_isa_flags = TARGET_64BIT_DEFAULT | TARGET_SUBTARGET_ISA_DEFAULT +HOST_WIDE_INT ix86_isa_flags = TARGET_64BIT_DEFAULT | TARGET_SUBTARGET_ISA_DEFAULT ; A mask of ix86_isa_flags that includes bit X if X was set or cleared ; on the command line. Variable -int ix86_isa_flags_explicit +HOST_WIDE_INT ix86_isa_flags_explicit ;; Definitions to add to the cl_target_option structure ;; -march= processor @@ -50,7 +50,7 @@ unsigned char branch_cost ;; which flags were passed by the user TargetSave -int x_ix86_isa_flags_explicit +HOST_WIDE_INT x_ix86_isa_flags_explicit ;; which flags were passed by the user TargetSave diff --git a/gcc/hwint.h b/gcc/hwint.h index fa77b11..6135136 100644 --- a/gcc/hwint.h +++ b/gcc/hwint.h @@ -79,6 +79,7 @@ extern char sizeof_long_long_must_be_8[sizeof(long long) == 8 ? 1 : -1]; #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG # define HOST_WIDE_INT_PRINT HOST_LONG_FORMAT # define HOST_WIDE_INT_PRINT_C "L" +# define HOST_WIDE_INT_1 1L /* 'long' might be 32 or 64 bits, and the number of leading zeroes must be tweaked accordingly. */ # if HOST_BITS_PER_WIDE_INT == 64 @@ -91,6 +92,7 @@ extern char sizeof_long_long_must_be_8[sizeof(long long) == 8 ? 1 : -1]; #else # define HOST_WIDE_INT_PRINT HOST_LONG_LONG_FORMAT # define HOST_WIDE_INT_PRINT_C "LL" +# define HOST_WIDE_INT_1 1LL /* We can assume that 'long long' is at least 64 bits. */ # define HOST_WIDE_INT_PRINT_DOUBLE_HEX \ "0x%" HOST_LONG_LONG_FORMAT "x%016" HOST_LONG_LONG_FORMAT "x" diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index 945eeb1..1f582fb 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -110,6 +110,11 @@ function switch_flags (flags) # Return bit-field initializers for option flags FLAGS. function switch_bit_fields (flags) { + vn = var_name(flags); + if (host_wide_int[vn] == "yes") + hwi = "Host_Wide_Int" + else + hwi = "" result = "" sep_args = opt_args("Args", flags) if (sep_args == "") @@ -126,6 +131,7 @@ function switch_bit_fields (flags) flag_init("RejectNegative", flags) \ flag_init("JoinedOrMissing", flags) \ flag_init("UInteger", flags) \ + flag_init("Host_Wide_Int", hwi) \ flag_init("ToLower", flags) \ flag_init("Report", flags) @@ -140,6 +146,17 @@ function var_name(flags) return nth_arg(0, opt_args("Var", flags)) } +# Return the name of the variable if FLAGS has a HOST_WIDE_INT variable. +# Return the empty string otherwise. +function host_wide_int_var_name(flags) +{ + split (flags, array, "[ \t]+") + if (array[1] == "HOST_WIDE_INT") + return array[2] + else + return "" +} + # Return true if the option described by FLAGS has a globally-visible state. function global_state_p(flags) { @@ -197,8 +214,12 @@ function var_type_struct(flags) return enum_type[en] " " } else if (!flag_set_p("Joined.*", flags) && !flag_set_p("Separate", flags)) { - if (flag_set_p(".*Mask.*", flags)) - return "int " + if (flag_set_p(".*Mask.*", flags)) { + if (host_wide_int[var_name(flags)] == "yes") + return "HOST_WIDE_INT " + else + return "int " + } else return "signed char " } diff --git a/gcc/opt-read.awk b/gcc/opt-read.awk index c488ed5..6a4d4de 100644 --- a/gcc/opt-read.awk +++ b/gcc/opt-read.awk @@ -51,6 +51,9 @@ BEGIN { else if ($1 == "Variable") { extra_vars[n_extra_vars] = $2 n_extra_vars++ + name = host_wide_int_var_name($2) + if (name != "") + host_wide_int[name] = "yes" } else if ($1 == "TargetVariable") { # Combination of TargetSave and Variable diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk index 4efc115..654d869 100644 --- a/gcc/optc-save-gen.awk +++ b/gcc/optc-save-gen.awk @@ -363,10 +363,16 @@ print "{"; print " fputs (\"\\n\", file);"; for (i = 0; i < n_target_other; i++) { print " if (ptr->x_" var_target_other[i] ")"; - print " fprintf (file, \"%*s%s (%#lx)\\n\","; + if (host_wide_int[var_target_other[i]] == "yes") + print " fprintf (file, \"%*s%s (%#\" HOST_WIDE_INT_PRINT \"x)\\n\","; + else + print " fprintf (file, \"%*s%s (%#x)\\n\","; print " indent, \"\","; print " \"" var_target_other[i] "\","; - print " (unsigned long)ptr->x_" var_target_other[i] ");"; + if (host_wide_int[var_target_other[i]] == "yes") + print " ptr->x_" var_target_other[i] ");"; + else + print " (unsigned long)ptr->x_" var_target_other[i] ");"; print ""; } diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index 876e0f6..2bae695 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -300,18 +300,26 @@ for (i = 0; i < n_opts; i++) { name = opt_args("Mask", flags[i]) vname = var_name(flags[i]) mask = "MASK_" + mask_1 = "1" if (vname != "") { mask = "OPTION_MASK_" + if (host_wide_int[vname] == "yes") + mask_1 = "HOST_WIDE_INT_1" } if (name != "" && !flag_set_p("MaskExists", flags[i])) - print "#define " mask name " (1 << " masknum[vname]++ ")" + print "#define " mask name " (" mask_1 " << " masknum[vname]++ ")" } for (i = 0; i < n_extra_masks; i++) { print "#define MASK_" extra_masks[i] " (1 << " masknum[""]++ ")" } for (var in masknum) { - if (masknum[var] > 31) { + if (var != "" && host_wide_int[var] == "yes") { + print" #if defined(HOST_BITS_PER_WIDE_INT) && " masknum[var] " >= HOST_BITS_PER_WIDE_INT" + print "#error too many masks for " var + print "#endif" + } + else if (masknum[var] > 31) { if (var == "") print "#error too many target masks" else diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 973dd7e..0b86764 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -1088,9 +1088,14 @@ set_option (struct gcc_options *opts, struct gcc_options *opts_set, break; case CLVC_EQUAL: - *(int *) flag_var = (value - ? option->var_value - : !option->var_value); + if (option->cl_host_wide_int) + *(HOST_WIDE_INT *) flag_var = (value + ? option->var_value + : !option->var_value); + else + *(int *) flag_var = (value + ? option->var_value + : !option->var_value); if (set_flag_var) *(int *) set_flag_var = 1; break; @@ -1098,11 +1103,26 @@ set_option (struct gcc_options *opts, struct gcc_options *opts_set, case CLVC_BIT_CLEAR: case CLVC_BIT_SET: if ((value != 0) == (option->var_type == CLVC_BIT_SET)) - *(int *) flag_var |= option->var_value; + { + if (option->cl_host_wide_int) + *(HOST_WIDE_INT *) flag_var |= option->var_value; + else + *(int *) flag_var |= option->var_value; + } else - *(int *) flag_var &= ~option->var_value; + { + if (option->cl_host_wide_int) + *(HOST_WIDE_INT *) flag_var &= ~option->var_value; + else + *(int *) flag_var &= ~option->var_value; + } if (set_flag_var) - *(int *) set_flag_var |= option->var_value; + { + if (option->cl_host_wide_int) + *(HOST_WIDE_INT *) set_flag_var |= option->var_value; + else + *(int *) set_flag_var |= option->var_value; + } break; case CLVC_STRING: @@ -1173,13 +1193,22 @@ option_enabled (int opt_idx, void *opts) return *(int *) flag_var != 0; case CLVC_EQUAL: - return *(int *) flag_var == option->var_value; + if (option->cl_host_wide_int) + return *(HOST_WIDE_INT *) flag_var == option->var_value; + else + return *(int *) flag_var == option->var_value; case CLVC_BIT_CLEAR: - return (*(int *) flag_var & option->var_value) == 0; + if (option->cl_host_wide_int) + return (*(HOST_WIDE_INT *) flag_var & option->var_value) == 0; + else + return (*(int *) flag_var & option->var_value) == 0; case CLVC_BIT_SET: - return (*(int *) flag_var & option->var_value) != 0; + if (option->cl_host_wide_int) + return (*(HOST_WIDE_INT *) flag_var & option->var_value) != 0; + else + return (*(int *) flag_var & option->var_value) != 0; case CLVC_STRING: case CLVC_ENUM: @@ -1206,7 +1235,9 @@ get_option_state (struct gcc_options *opts, int option, case CLVC_BOOLEAN: case CLVC_EQUAL: state->data = flag_var; - state->size = sizeof (int); + state->size = (cl_options[option].cl_host_wide_int + ? sizeof (HOST_WIDE_INT) + : sizeof (int)); break; case CLVC_BIT_CLEAR: diff --git a/gcc/opts.h b/gcc/opts.h index b070c8f..3c0fe3f 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -96,6 +96,8 @@ struct cl_option BOOL_BITFIELD cl_missing_ok : 1; /* Argument is an integer >=0. */ BOOL_BITFIELD cl_uinteger : 1; + /* Argument is a HOST_WIDE_INT. */ + BOOL_BITFIELD cl_host_wide_int : 1; /* Argument should be converted to lowercase. */ BOOL_BITFIELD cl_tolower : 1; /* Report argument with -fverbose-asm */ @@ -109,7 +111,7 @@ struct cl_option /* How this option's value is determined and sets a field. */ enum cl_var_type var_type; /* Value or bit-mask with which to set a field. */ - int var_value; + HOST_WIDE_INT var_value; }; /* Records that the state of an option consists of SIZE bytes starting ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-08-17 20:41 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-08-06 16:05 PING: PATCH: Use int64 for x86 options H.J. Lu 2011-08-08 2:18 ` H.J. Lu 2011-08-09 13:32 ` H.J. Lu 2011-08-09 14:07 ` Joseph S. Myers 2011-08-09 14:22 ` H.J. Lu 2011-08-16 13:09 ` H.J. Lu 2011-08-16 13:48 ` Joseph S. Myers 2011-08-17 19:28 ` Joseph S. Myers 2011-08-17 20:27 ` H.J. Lu 2011-08-17 20:35 ` Joseph S. Myers 2011-08-17 20:41 ` H.J. Lu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).