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]

Re: PATCH: Add Intel Atom optimization


On Mon, Apr 6, 2009 at 2:25 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> On Tue, Mar 31, 2009 at 1:20 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>
>> Changes are mainly in following aspects:
>> - Atom instruction selection. For example, using lea or add for add/sub
>> operation.
>> - Atom pipeline description, mostly in atom.md
>> - X86_TUNE flags tuning for Atom
>>
>> 32-bits performance experiment on Atom box showed following
>> ATOM_OPT/BASE_OPT
>> speedup:
>> CPU2000 INT: 1.03 (which means ATOM_OPT is 3% faster than BASE_OPT)
>> CPU2000 FP: 1.06
>> EEMBC 1.1: 1.06
>> EEMBC 2.0 Consumer: 1.09
>>
>> BASE_OPT=-m32 -O2 -mfpmath=sse -ffast-math -mssse3
>> ATOM_OPT=-m32 -O2 -mfpmath=sse -ffast-math -march=atom
>> Passed all test. Based on trunk revision: 143853
>>
>> There are two approaches to enable Atom specific optimizations. One is
>> to use command line option -march=atom or -mtune=atom. Another is
>> to use config option --with-arch=atom --with-cpu=atom to enable Atom
>> as default.
>>
>> OK for trunk?
>
> H.J.,
>
> atom.md license header is GPL v2, this should probably be changed to v3.
>
> Other than that, I will just rubber-stamp atom.md and various config
> bits, so these are OK for mainline. But please see below for i386.c
> part.
>
>> ? ? ? ?* config/i386/i386-protos.h (ix86_lea_for_add_ok): Declare new
>> ? ? ? ?function.
>> ? ? ? ?(ix86_dep_by_shift_count): Likewise.
>> ? ? ? ?(ix86_agi_dependent): Likewise.
>
> ix86_agi_dependent functions are not part of this patch, please update
> ChangeLog.
>
>> ? ? ? ?(distance_non_agu_define): New function.
>> ? ? ? ?(reg_mentioned_by_mem_p): Likewise.
>> ? ? ? ?(distance_agu_use): Likewise.
>> ? ? ? ?(ix86_lea_for_add_ok): Likewise.
>
> please remove above functions from the patch and put them in a
> separate follow-up patch. The main problem is with LEA discovery code
> (see the comment above distance_non_agu_define). Since this function
> is used after reload, we can use get_attr_type function on the insn
> RTL. This func will determine, if insn is LEA or not. Also, perhaps
> Steven B sees some opportunity to use DF infrastructure here instead
> of scanning insn stream every time the function is called.
>
>> ? ? ? ?(ix86_dep_by_shift_count): Likewise.
>
> Also with the above function. Please separate this function to a
> follow-up patch. Can we use DF here?
>
>> ? ? ? ?(ix86_agi_dependent): Make it global.
>
> Not in this patch, please update ChangeLog.
>
> Uros.
>

Hi,

This is the Atom patch I am checking in. I will submit
a follow-up patch for the other changes.

Thanks.


-- 
H.J.
---
2009-04-06  Joey Ye  <joey.ye@intel.com>
	    Xuepeng Guo <xuepeng.guo@intel.com>
	    H.J. Lu  <hongjiu.lu@intel.com>

	Atom pipeline model, tuning and insn selection.
	* config.gcc (atom): Add atom config options and target.

	* config/i386/atom.md: New.

	* config/i386/i386.c (atom_cost): New cost.
	(m_ATOM): New macro flag.
	(initial_ix86_tune_features): Set m_ATOM.
	(x86_accumulate_outgoing_args): Likewise.
	(x86_arch_always_fancy_math_387): Likewise.
	(processor_target): Add Atom cost.
	(cpu_names): Add Atom cpu name.
	(override_options): Set Atom ISA.
	(ix86_issue_rate): New case PROCESSOR_ATOM.
	(ix86_adjust_cost): Likewise.

	* config/i386/i386.h (TARGET_ATOM): New target macro.
	(ix86_tune_indices): Add X86_TUNE_OPT_AGU.
	(TARGET_OPT_AGU): New target option.
	(target_cpu_default): Add TARGET_CPU_DEFAULT_atom.
	(processor_type): Add PROCESSOR_ATOM.

	* config/i386/i386.md (cpu): Add new value "atom".
	(use_carry, movu): New attr.
	(atom.md): Include atom.md.
	(adddi3_carry_rex64): Set attr "use_carry".
	(addqi3_carry): Likewise.
	(addhi3_carry): Likewise.
	(addsi3_carry): Likewise.
	(*addsi3_carry_zext): Likewise.
	(subdi3_carry_rex64): Likewise.
	(subqi3_carry): Likewise.
	(subhi3_carry): Likewise.
	(subsi3_carry): Likewise.
	(x86_movdicc_0_m1_rex64): Likewise.
	(*x86_movdicc_0_m1_se): Likewise.
	(x86_movsicc_0_m1): Likewise.
	(*x86_movsicc_0_m1_se): Likewise.
	(*adddi_1_rex64): Emit add insn as much as possible.
	(*addsi_1): Likewise.
	(return_internal): Set atom_unit.
	(return_internal_long): Likewise.
	(return_pop_internal): Likewise.
	(*rcpsf2_sse): Set atom_sse_attr attr.
	(*qrt<mode>2_sse): Likewise.
	(*prefetch_sse): Likewise.

	* config/i386/i386-c.c (ix86_target_macros_internal): New case
	PROCESSOR_ATOM.
	(ix86_target_macros_internal): Likewise.

	* config/i386/sse.md (cpu): Set attr "atom_sse_attr".
	(*prefetch_sse_rex): Likewise.
	(sse_rcpv4sf2): Likewise.
	(sse_vmrcpv4sf2): Likewise.
	(sse_sqrtv4sf2): Likewise.
	(<sse>_vmsqrt<mode>2): Likewise.
	(sse_ldmxcsr): Likewise.
	(sse_stmxcsr): Likewise.
	(*sse_sfence): Likewise.
	(sse2_clflush): Likewise.
	(*sse2_mfence): Likewise.
	(*sse2_lfence): Likewise.
	(avx_movup<avxmodesuffixf2c><avxmodesuffix>): Set attr "movu".
	(<sse>_movup<ssemodesuffixf2c>): Likewise.
	(avx_movdqu<avxmodesuffix>): Likewise.
	(avx_lddqu<avxmodesuffix>): Likewise.
	(sse2_movntv2di): Change attr "type" to "ssemov".
	(sse2_movntsi): Likewise.
	(rsqrtv8sf2): Change attr "type" to "sseadd".
	(sse3_addsubv2df3): Set attr "atom_unit".
	(sse3_h<plusminus_insn>v4sf3): Likewise.
	(*sse2_pmaddwd): Likewise.
	(*vec_extractv2di_1_rex64): Likewise.
	(*vec_extractv2di_1_avx): Likewise.
	(sse2_psadbw): Likewise.
	(ssse3_phaddwv8hi3): Likewise.
	(ssse3_phaddwv4hi3): Likewise.
	(ssse3_phadddv4si3): Likewise.
	(ssse3_phadddv2si3): Likewise.
	(ssse3_phaddswv8hi3): Likewise.
	(ssse3_phaddswv4hi3): Likewise.
	(ssse3_phsubwv8hi3): Likewise.
	(ssse3_phsubwv4hi3): Likewise.
	(ssse3_phsubdv4si3): Likewise.
	(ssse3_phsubdv2si3): Likewise.
	(ssse3_phsubswv8hi3): Likewise.
	(ssse3_phsubswv4hi3): Likewise.
	(ssse3_pmaddubsw128): Likewise.
	(sse3_pmaddubsw: Likewise.
	(ssse3_palignrti): Likewise.
	(ssse3_palignrdi): Likewise.

Attachment: gcc-atom-2.patch
Description: Text document


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