RFC: PATCH: Require and use int64 for x86 options
H.J. Lu
hjl.tools@gmail.com
Thu Aug 4 22:09:00 GMT 2011
On Thu, Aug 4, 2011 at 11:08 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Jul 27, 2011 at 2:23 PM, Joseph S. Myers
> <joseph@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.lu@intel.com>
Igor Zamyatin <igor.zamyatin@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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-x86-int64-4.patch
Type: text/x-diff
Size: 18642 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20110804/a20e373b/attachment.bin>
More information about the Gcc
mailing list