On Thu, Aug 4, 2011 at 11:08 AM, H.J. Lu <hjl.to...@gmail.com> wrote:
> On Wed, Jul 27, 2011 at 2:23 PM, Joseph S. Myers
> <jos...@codesourcery.com> wrote:
>> On Wed, 27 Jul 2011, H.J. Lu wrote:
>>
>>> ; Maximum number of mask bits in a variable.
>>> MaxMaskBits
>>> ix86_isa_flags = 64
>>>
>>> It mark ix86_isa_flags as 64bit.  Any comments?
>>
>> The patch won't work as is.  set_option, for example, casts a pointer to
>> (int *), and stores a mask that came from option->var_value, which is an
>> int, so this won't work with option fields not of type int or values that
>> don't fit in int; you'd need to check all uses of CLVC_BIT_CLEAR and
>> CLVC_BIT_SET in the source tree to adapt things for the possibility of
>> wider mask fields, and track the type of each such field.
>>
>
> Here is the updated patch.  Tested on Linux/ia32 and Linux/x86-64. I
> used (1LL < X) for HOST_WIDE_INT instead of ((HOST_WIDE_INT) 1 << x)
> since we have
>
> #define OPTION_MASK_ISA_64BIT (1LL << 2)
> ...
> #define TARGET_64BIT_DEFAULT OPTION_MASK_ISA_64BIT
> ...
>
> #if TARGET_64BIT_DEFAULT
> #define OPT_ARCH64 "!m32"
> #define OPT_ARCH32 "m32"
> #else
> #define OPT_ARCH64 "m64|mx32"
> #define OPT_ARCH32 "m64|mx32:;"
> #endif
>
> and C preprocessor doesn't support ((HOST_WIDE_INT) 1 << x).
>
> OK for trunk?
>

Here is the updated patch to get proper HOST_WIDE_INT bits and 1
through a new file, opt-gen.c.  OK for trunk?

Thanks.


-- 
H.J.
----
2011-08-04  H.J. Lu  <hongjiu...@intel.com>
            Igor Zamyatin <igor.zamya...@intel.com>

        * Makefile.in (options.c): Depend on and use opt-gen$(exeext).
        (options-save.c): Likewise.
        (options.h): Likewise.
        (opt-gen$(exeext)): New target.

        * 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-gen.c: New.

        * 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.  Check
        max_mask_bits instead of 31 for target masks.

        * 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 (1LL << 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.
2011-08-04  H.J. Lu  <hongjiu...@intel.com>
	    Igor Zamyatin <igor.zamya...@intel.com>

	* Makefile.in (options.c): Depend on and use opt-gen$(exeext).
	(options-save.c): Likewise.
	(options.h): Likewise.
	(opt-gen$(exeext)): New target.

	* 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-gen.c: New.

	* 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.  Check
	max_mask_bits instead of 31 for target masks.

	* 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 (1LL << 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/Makefile.in b/gcc/Makefile.in
index 0204f93..fd14c35 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2245,22 +2245,22 @@ s-options: $(ALL_OPT_FILES) Makefile $(srcdir)/opt-gather.awk
 	$(STAMP) s-options
 
 options.c: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opt-read.awk \
-    $(srcdir)/optc-gen.awk
+    $(srcdir)/optc-gen.awk opt-gen$(exeext)
 	$(AWK) -f $(srcdir)/opt-functions.awk -f $(srcdir)/opt-read.awk \
-	       -f $(srcdir)/optc-gen.awk \
+	       -f $(srcdir)/optc-gen.awk `./opt-gen$(exeext)` \
 	       -v header_name="config.h system.h coretypes.h tm.h" < $< > $@
 
 options-save.c: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opt-read.awk \
-    $(srcdir)/optc-save-gen.awk
+    $(srcdir)/optc-save-gen.awk opt-gen$(exeext)
 	$(AWK) -f $(srcdir)/opt-functions.awk -f $(srcdir)/opt-read.awk \
-	       -f $(srcdir)/optc-save-gen.awk \
+	       -f $(srcdir)/optc-save-gen.awk `./opt-gen$(exeext)` \
 	       -v header_name="config.h system.h coretypes.h tm.h" < $< > $@
 
 options.h: s-options-h ; @true
 s-options-h: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opt-read.awk \
-    $(srcdir)/opth-gen.awk
+    $(srcdir)/opth-gen.awk opt-gen$(exeext)
 	$(AWK) -f $(srcdir)/opt-functions.awk -f $(srcdir)/opt-read.awk \
-	       -f $(srcdir)/opth-gen.awk \
+	       -f $(srcdir)/opth-gen.awk `./opt-gen$(exeext)` \
 	       < $< > tmp-options.h
 	$(SHELL) $(srcdir)/../move-if-change tmp-options.h options.h
 	$(STAMP) $@
@@ -4043,6 +4043,10 @@ gengtype-lex.c : gengtype-lex.l
 	  mv $@.tmp $@; \
 	}
 
+opt-gen$(exeext) : opt-gen.c $(BCONFIG_H) $(SYSTEM_H)
+	$(COMPILER_FOR_BUILD) $(BUILD_COMPILERFLAGS) $(BUILD_CPPFLAGS) \
+		-o $@ $(srcdir)/opt-gen.c
+
 #
 # Remake internationalization support.
 intl.o: intl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h Makefile
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 *));
 
 
 /* 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 a7f8ee5..397a809 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	 	(1LL << 0)
+#define PTA_3DNOW_A	 	(1LL << 1)
+#define PTA_64BIT		(1LL << 2)
+#define PTA_ABM			(1LL << 3)
+#define PTA_AES		 	(1LL << 4)
+#define PTA_AVX			(1LL << 5)
+#define PTA_BMI		 	(1LL << 6)
+#define PTA_CX16		(1LL << 7)
+#define PTA_F16C		(1LL << 8)
+#define PTA_FMA			(1LL << 9)
+#define PTA_FMA4	 	(1LL << 10)
+#define PTA_FSGSBASE		(1LL << 11)
+#define PTA_LWP		 	(1LL << 12)
+#define PTA_LZCNT	 	(1LL << 13)
+#define PTA_MMX			(1LL << 14)
+#define PTA_MOVBE		(1LL << 15)
+#define PTA_NO_SAHF		(1LL << 16)
+#define PTA_PCLMUL		(1LL << 17)
+#define PTA_POPCNT		(1LL << 18)
+#define PTA_PREFETCH_SSE	(1LL << 19)
+#define PTA_RDRND	 	(1LL << 20)
+#define PTA_SSE			(1LL << 21)
+#define PTA_SSE2		(1LL << 22)
+#define PTA_SSE3		(1LL << 23)
+#define PTA_SSE4_1	 	(1LL << 24)
+#define PTA_SSE4_2	 	(1LL << 25)
+#define PTA_SSE4A		(1LL << 26)
+#define PTA_SSSE3		(1LL << 27)
+#define PTA_TBM		 	(1LL << 28)
+#define PTA_XOP		 	(1LL << 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[] =
     {
@@ -24047,7 +24046,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;
 };
@@ -24072,7 +24071,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;
@@ -24110,7 +24110,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);
@@ -24127,7 +24127,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;
 
@@ -24161,7 +24161,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/opt-functions.awk b/gcc/opt-functions.awk
index 945eeb1..5edfe63 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 (max_mask_bits[vn] == HOST_BITS_PER_WIDE_INT)
+		host_wide_int = "Host_Wide_Int"
+	else
+		host_wide_int = ""
 	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", host_wide_int) \
 	  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 (max_mask_bits[var_name(flags)] == HOST_BITS_PER_WIDE_INT)
+				return "HOST_WIDE_INT "
+			else
+				return "int "
+		}
 		else
 			return "signed char "
 	}
diff --git a/gcc/opt-gen.c b/gcc/opt-gen.c
new file mode 100644
index 0000000..a7770d6
--- /dev/null
+++ b/gcc/opt-gen.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2011
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#include "bconfig.h"
+#include "system.h"
+
+int
+main (void)
+{
+  printf ("-v HOST_BITS_PER_WIDE_INT=%d\n", HOST_BITS_PER_WIDE_INT);
+  printf ("-v HOST_WIDE_INT_1=1%s\n", HOST_WIDE_INT_PRINT_C);
+  return 0;
+}
diff --git a/gcc/opt-read.awk b/gcc/opt-read.awk
index c488ed5..d3e6500 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 != "")
+				max_mask_bits[name] = HOST_BITS_PER_WIDE_INT
 		}
 		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..b2e8adb 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 (max_mask_bits[var_target_other[i]] == HOST_BITS_PER_WIDE_INT)
+		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 (max_mask_bits[var_target_other[i]] == HOST_BITS_PER_WIDE_INT)
+		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..f0f7e0e 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -300,18 +300,24 @@ 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 (max_mask_bits[vname] == HOST_BITS_PER_WIDE_INT)
+			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) {
+	max = max_mask_bits[var]
+	if (max == "")
+	  max = 32
+	if (masknum[var] >= max) {
 		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

Reply via email to