[PATCH V2, i386]: Change options handling for i386 target

Uros Bizjak ubizjak@gmail.com
Tue May 29 18:45:00 GMT 2007


H. J. Lu wrote:

>>
>> Here is another update of option handling patch, local to i386
>> directory. I think that better way is to use OPTION_* handling, as
>> this _is_ the infrastructure which enables the functionality we want.
>>
>>     
>
> I prefer OPTION_ISA_*. Otherwise, it is hard to tell OPTION_GLIBC 
> from OPTION_SSE that they are in 2 different sets of masks.
>
>   

Please find updated patch attached. This patch also fixes wrong 64bit 
ISA selection on 64bit target for -m32 - we need to initialize 
"ix86_isa_flags" statically. Patch was bootstrapped and regression 
tested on x86_64-pc-linux-gnu for all default languages.

BTW: Does Darwin need

#ifdef IN_LIBGCC2
#undef TARGET_64BIT
#ifdef __x86_64__
#define TARGET_64BIT 1
#else
#define TARGET_64BIT 0
#endif
#endif

as exactly the same construct is is already defined in i386.h?


2007-05-29  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.h (TARGET_ABM): New define.
    (TARGET_POPCNT): Ditto.
    (TARGET_64BIT, TARGET_MMX, TARGET_3DNOW, TARGET_3DNOW_A, TARGET_SSE*):
    New temporary defines to redefine from OPTION_ISA_* defines.
    (MASK_64BIT, MASK_MMX, MASK_3DNOW, MASK_3DNOW_A, MASK_SSE*):
    New temporary defines to redefine from OPTION_MASK_ISA_* defines.
    (ix86_isa_flags): New extern int declaration.
    (TARGET_SUBTARGET_DEFAULT): New define.
    (TARGET_SUBTARGET_ISA_DEFAULT): Ditto.
    (TARGET_SUBTARGET32_DEFAULT): Ditto..
    (TARGET_SUBTARGET32_ISA_DEFAULT): Ditto.
    (TARGET_SUBTARGET64_ISA_DEFAULT): Ditto.
    * config/i386/unix.h: Undef TARGET_SUBTARGET_DEFAULT before define.
    * config/i386/darwin.h: Remove default TARGET_64BIT define.

    * config/i386/i386.opt (m3dnowa): Define as undocumented option
    using existing "ix86_isa_flags" varible.
    (m32, m64): Use existing "ix86_isa_flags" variable.
    (mmmx, m3dnow): Ditto.
    (msse, msse2, msse3, mssse3, msse4.1, msse4a): Ditto.
    (mabm): Define as non-negative option using "x86_abm" variable.
    (mpopcnt): Define as non-negative option using "x86_popcnt" variable.

    * config/i386/i386.c (ix86_arch_features) [X86_ARCH_CMOVE]:
    Rewrite feature test bitmap.
    (ix86_isa_flags): New initialized global int varible.
    (ix86_isa_flags_explicit): New static int variable.
    (ix86_handle_option): Set "ix86_isa_flags_explicit" when mmmx, m3dnow,
    msse, msse2, msse3, msse4.1 and msse4a option is processed.  Change
    i86_isa_flags and ix86_isa_flags_explicit, not target_flags and
    target_flags_explicit.
    (override_options): Remove "target_enable" and "target_disable" fields
    from "struct ptt". Update processor_target_table accordingly. Remove
    PTA_PREFETCH_SSE from processor_alias_table entry if PTE_SSE is
    defined and rearrange PTA_* bits.  Switch on TARGET_64BIT if
    TARGET_64BIT_DEFAULT is set.  Switch on default "ix86_isa_flags"
    according to TARGET_SUBTARGET_ISA_DEFAULT.  Use "ix86_isa_flags"
    instead of "target_flags" and "ix86_isa_flags_explicit"
    instead of "target_flags_explicit" when masked with MASK_64BIT,
    MASK_MMX, MASK_3DNOW, MASK_3DNOW_A or MASK_SSE*.  Set "x86_abm" to
    true when PTA_ABM is set in processor_alias_table flags entry.  Set
    "x86_popcnt" to true when either of PTA_POPCNT or PTA_ABM is set in
    processor_alias_table flags entry.  Set "x86_prefetch_sse" to true
    when either of PTA_PREFETCH_SSE or PTA_SSE is set in
    processor_alias_table flags entry.  Remove handling of
    "target_enable" and "target_disable" fields of processor_target_table.
    Mask "target_flags" with TARGET_SUBTARGET32_DEFAULT for 32-bit
    targets or with TARGET_SUBTARGET64_DEFAULT for 64-bit targets.
    Mask "ix86_isa_flags" with TARGET_SUBTARGET32_ISA_DEFAULT for 32-bit
    targets or with TARGET_SUBTARGET64_ISA_DEFAULT for 64-bit targets.
    (def_builtin): Mask "mask" variable with "ix86_isa_flags", not
    "target_flags".
    (TARGET_DEFAULT_TARGET_FLAGS): Do not include TARGET_64BIT_DEFAULT.

Uros.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: i386-options-2.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070529/fb7f5f53/attachment.txt>


More information about the Gcc-patches mailing list