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, i386]: Optimization of the i386 and x86_64 compilers


> Hello!
> 
> Attached patch implements the idea, proposed by Michael Meissner in PR
> 31019. The core of his idea is to substitute (1 << ix86_[tune|arch])
> in x86_some_var & (1 << ix86_[tune|arch])) by a precalculated global
> variable.
> 
> The results of this patch are quite suprising as the text size of cc1
> on i686 host was lowered considerably:
> 
> size cc1
>   text    data     bss     dec     hex filename
> 7632793   18876  574516 8226185  7d8589 cc1
> 
> size cc1-patched
>   text    data     bss     dec     hex filename
> 6731749   18876  574516 7325141  6fc5d5 cc1-patched
> 
> Yes, for 901k.

Neat :)  It also imply that our insn-attrtab/insn-recog is truly ugly
piece of autogenerated code, but this is very nice win.

I wonder if we are able to fold something like
(((1 << var) & 0x2) || ((1 << var) & 0x4)) into (1<<var) & 0x6
as we can do for var & 0x2 || var & 0x4 since the former is how a lot of
code looks like.

Once I used to be able to reduce insn-attrtab size considerably via pure
attributes on the predicate functions.  THis wasn't considered safe as
people might want to add something non-pure into the functions, but
perhaps now we can consider pushing some of very trivial predicates into
inlined headers to allow more compiler optimization to trigger...
> 
> 
> 2007-03-02  Uros Bizjak  <ubizjak@gmail.com>
> 	    Michael Meissner  <michael.meissner@amd.com>
> 
>        * config/i386/i386.h (TUNEMASK): Redefine to use ix86_tune_mask.
> 	(ARCHMASK): Define.
> 	(TARGET_CMOVE): Use ARCHMASK.
> 	(TARGET_CMPXCHG): Ditto.
> 	(TARGET_CMPXCHG8B): Ditto.
> 	(TARGET_XADD): Ditto.
> 	(TARGET_BSWAP): Ditto.
> 	* config/i386/i386.c (ix86_tune_mask): New global variable.
> 	(ix86_arch_mask): Ditto.
> 	(override_options): Initialize ix86_tune_mask and
> 	ix86_arch_mask. Use ARCHMASK to clear MASK_NO_FANCY_MATH_387 in
> 	target_flags.
> 
> The patch was bootstrapped on i686-pc-linux-gnu, regression tested for
> c, c++ and gfortran.

You didn't mentioned if you are waiting for approval or just going to
commit it, so just in case this is OK :)

Honza


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