This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hello!

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.

Attached patch moves handling of MASK_64BIT, MASK_MMX, MASK_3DNOW* and
MASK_SSE* to "ix86_isa_flags" variable and introduces
TARGET_SUBTARGET[32|64]_ISA_DEFAULT defines. Fortunatelly, no current
TARGET_SUBTARGET_DEFAULT includes any ISA changing flags, but I'd like
to introduce TARGET_SUBTARGET_ISA_DEFAULT and
TARGET_SUBTARGET32_DEFAULT macros for subtargets to be able to change
default ISA flags and default 32bit subtarget flags.

Also, handling of TARGET_POPCNT and TARGET_ABM was moved from
"target_flags" into separate variables, as it is already the case with
-mcx16 and -msahf. IMO, there is no need for "-mno-abm" or
"-mno-popcnt" as these options _enable_ certain instructions. If the
target doesn't support these insn, relevant PTA_* flags should be
removed from processor aliast table.

Processor alias table was rearranged a bit. The most notable change is
w.r.t. PTA_PREFETCH_SSE. This is now included only if target does
_not_ include SSE support, so new target (with SSE) won't need to add
this flag. (Similar [inverse] change was added to X86_ARCH_CMOVE
ix86_arch_features[] array, where CORE2 was accidentally left out of
X86_ARCH_CMOVE support).

I have also removed unused "processor_enable" and "processor_disable"
fields from processor_target_table[]. processor_alias_table[] is
enough for enabling various target features.

The patch was regression tested on i686-pc-linux-gnu for all default
languages. I plan to re-run the tests on x86_64 in a couple of hours.
However, I would like someone to test this change on Darwin, due to
small darwin.h change - do we really need to redefine TARGET_64BIT
define to the same default value... ?

After this patch is committed to SVN (in a couple of days), I plan to
change all relevant MASK_* defines to OPTION_MASK_* to clearly
separate target_flags and ix86_isa_flags masks.

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 OPTIONS_* defines.
	(MASK_64BIT, MASK_MMX, MASK_3DNOW, MASK_3DNOW_A, MASK_SSE*):
	New temporary defines to redefine from MASK_* defines.
	(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/biarch64.h: Redefine TARGET_64BIT_DEFAULT to 1.

	* config/i386/i386.opt (m32, m64): Use "ix86_isa_flags" variable.
	(mmmx, m3dnow): Ditto.
	(m3dnowa): Define as undocumented option.
	(msse, msse2, msse3, mssse3, msse4.1, msse4a): Use "ix86_isa_flags"
	variable.
	(mabm): Define as non-negative option using "x86_abm" varialbe.
	(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_explicit): New static int.
	(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.

Attachment: i386-options.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]