diff options
author | Jan Hubicka <hubicka@freesoft.cz> | 1999-11-19 09:12:18 +0000 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 1999-11-19 09:12:18 +0000 |
commit | 96e7ae40d8b639b1f257162a414c729f75e9c035 (patch) | |
tree | 577a63534540be656ad0c7931693f22e26974e59 | |
parent | 25b540c639e38e008e16b2c00c47fdf21bc96eab (diff) | |
download | gcc-96e7ae40d8b639b1f257162a414c729f75e9c035.zip gcc-96e7ae40d8b639b1f257162a414c729f75e9c035.tar.gz gcc-96e7ae40d8b639b1f257162a414c729f75e9c035.tar.bz2 |
i386.h (struct_processor_costs): New fileds int_load, int_store, fp_move, fp_load and fp_store
* i386.h (struct_processor_costs): New fileds int_load, int_store, fp_move,
fp_load and fp_store
(REGISTER_MOVE_COST): Fix comment, calculate exactly the cost of
fp->int moves
(MEMORY_MOVE_COST): New macro.
* i386.c (386_cost): Define new fields.
(i486_cost): Likewise.
(pentium_cost): Likewise.
(pentiumpro_cost): Likewise.
(k6_cost): Likewise.
From-SVN: r30585
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 50 | ||||
-rw-r--r-- | gcc/config/i386/i386.h | 52 |
3 files changed, 97 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f5f4125..46c575b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +Fri Nov 18 13:39:22 CET 1999 Jam Hubicka <hubicka@freesoft.cz> + * i386.h (struct_processor_costs): New fileds int_load, int_store, fp_move, + fp_load and fp_store + (REGISTER_MOVE_COST): Fix comment, calculate exactly the cost of + fp->int moves + (MEMORY_MOVE_COST): New macro. + * i386.c (386_cost): Define new fields. + (i486_cost): Likewise. + (pentium_cost): Likewise. + (pentiumpro_cost): Likewise. + (k6_cost): Likewise. + Fri Nov 19 11:11:55 1999 Greg McGary <gkm@gnu.org> Geoffrey Keating <geoffk@cygnus.com> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index c8e8995..4707ebff9 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -63,7 +63,15 @@ struct processor_costs i386_cost = { /* 386 specific costs */ 6, /* cost of starting a multiply */ 1, /* cost of multiply per each bit set */ 23, /* cost of a divide/mod */ - 15 /* "large" insn */ + 15, /* "large" insn */ + {2, 4, 2}, /* cost of loading integer registers + in QImode, HImode and SImode. + Relative to reg-reg move (2). */ + {2, 4, 2}, /* cost of storing integer registers */ + 2, /* cost of reg,reg fld/fst */ + {8, 8, 8}, /* cost of loading fp registers + in SFmode, DFmode and XFmode */ + {8, 8, 8} /* cost of loading integer registers */ }; struct processor_costs i486_cost = { /* 486 specific costs */ @@ -74,7 +82,15 @@ struct processor_costs i486_cost = { /* 486 specific costs */ 12, /* cost of starting a multiply */ 1, /* cost of multiply per each bit set */ 40, /* cost of a divide/mod */ - 15 /* "large" insn */ + 15, /* "large" insn */ + {2, 4, 2}, /* cost of loading integer registers + in QImode, HImode and SImode. + Relative to reg-reg move (2). */ + {2, 4, 2}, /* cost of storing integer registers */ + 2, /* cost of reg,reg fld/fst */ + {8, 8, 8}, /* cost of loading fp registers + in SFmode, DFmode and XFmode */ + {8, 8, 8} /* cost of loading integer registers */ }; struct processor_costs pentium_cost = { @@ -85,7 +101,15 @@ struct processor_costs pentium_cost = { 11, /* cost of starting a multiply */ 0, /* cost of multiply per each bit set */ 25, /* cost of a divide/mod */ - 8 /* "large" insn */ + 8, /* "large" insn */ + {2, 4, 2}, /* cost of loading integer registers + in QImode, HImode and SImode. + Relative to reg-reg move (2). */ + {2, 4, 2}, /* cost of storing integer registers */ + 2, /* cost of reg,reg fld/fst */ + {2, 2, 6}, /* cost of loading fp registers + in SFmode, DFmode and XFmode */ + {4, 4, 6} /* cost of loading integer registers */ }; struct processor_costs pentiumpro_cost = { @@ -96,7 +120,15 @@ struct processor_costs pentiumpro_cost = { 1, /* cost of starting a multiply */ 0, /* cost of multiply per each bit set */ 17, /* cost of a divide/mod */ - 8 /* "large" insn */ + 8, /* "large" insn */ + {4, 4, 4}, /* cost of loading integer registers + in QImode, HImode and SImode. + Relative to reg-reg move (2). */ + {2, 2, 2}, /* cost of storing integer registers */ + 2, /* cost of reg,reg fld/fst */ + {2, 2, 6}, /* cost of loading fp registers + in SFmode, DFmode and XFmode */ + {4, 4, 6} /* cost of loading integer registers */ }; struct processor_costs k6_cost = { @@ -107,7 +139,15 @@ struct processor_costs k6_cost = { 3, /* cost of starting a multiply */ 0, /* cost of multiply per each bit set */ 18, /* cost of a divide/mod */ - 8 /* "large" insn */ + 8, /* "large" insn */ + {4, 5, 4}, /* cost of loading integer registers + in QImode, HImode and SImode. + Relative to reg-reg move (2). */ + {2, 3, 2}, /* cost of storing integer registers */ + 4, /* cost of reg,reg fld/fst */ + {6, 6, 6}, /* cost of loading fp registers + in SFmode, DFmode and XFmode */ + {4, 4, 4} /* cost of loading integer registers */ }; struct processor_costs *ix86_cost = &pentium_cost; diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index ad52760..ee2b51f 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -62,6 +62,16 @@ struct processor_costs { int mult_bit; /* cost of multiply per each bit set */ int divide; /* cost of a divide/mod */ int large_insn; /* insns larger than this cost more */ + int int_load[3]; /* cost of loading integer registers + in QImode, HImode and SImode relative + to reg-reg move (2). */ + int int_store[3]; /* cost of storing integer register + in QImode, HImode and SImode */ + int fp_move; /* cost of reg,reg fld/fst */ + int fp_load[3]; /* cost of loading FP register + in SFmode, DFmode and XFmode */ + int fp_store[3]; /* cost of storing FP register + in SFmode, DFmode and XFmode */ }; extern struct processor_costs *ix86_cost; @@ -1956,22 +1966,28 @@ while (0) : REG_P (RTX) ? 1 \ : 2) -/* A C expression for the cost of moving data of mode M between a - register and memory. A value of 2 is the default; this cost is - relative to those in `REGISTER_MOVE_COST'. +/* A C expression for the cost of moving data from a register in class FROM to + one in class TO. The classes are expressed using the enumeration values + such as `GENERAL_REGS'. A value of 2 is the default; other values are + interpreted relative to that. - If moving between registers and memory is more expensive than - between two registers, you should define this macro to express the - relative cost. + It is not required that the cost always equal 2 when FROM is the same as TO; + on some machines it is expensive to move between registers if they are not + general registers. On the i386, copying between floating-point and fixed-point - registers is expensive. */ + registers is done trough memory. + + Integer -> fp moves are noticeably slower than the opposite direction + because of the partial memory stall they cause. Give it an + arbitary high cost. + */ #define REGISTER_MOVE_COST(CLASS1, CLASS2) \ - (((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \ - || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2))) ? 10 \ - : 2) - + ((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \ + ? (MEMORY_MOVE_COST (DFmode, CLASS1, 0) \ + + MEMORY_MOVE_COST (DFmode, CLASS2, 1)) \ + : (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2)) ? 10 : 2) /* A C expression for the cost of moving data of mode M between a register and memory. A value of 2 is the default; this cost is @@ -1981,7 +1997,19 @@ while (0) between two registers, you should define this macro to express the relative cost. */ -/* #define MEMORY_MOVE_COST(M,C,I) 2 */ +#define MEMORY_MOVE_COST(MODE,CLASS,IN) \ + (FLOAT_CLASS_P (CLASS) \ + ? (GET_MODE_SIZE (MODE)==4 \ + ? (IN ? ix86_cost->fp_load[0] : ix86_cost->fp_store[0]) \ + : (GET_MODE_SIZE (MODE)==8 \ + ? (IN ? ix86_cost->fp_load[1] : ix86_cost->fp_store[1]) \ + : (IN ? ix86_cost->fp_load[2] : ix86_cost->fp_store[2]))) \ + : (GET_MODE_SIZE (MODE)==1 \ + ? (IN ? ix86_cost->int_load[0] : ix86_cost->int_store[0]) \ + : (GET_MODE_SIZE (MODE)==2 \ + ? (IN ? ix86_cost->int_load[1] : ix86_cost->int_store[1]) \ + : ((IN ? ix86_cost->int_load[2] : ix86_cost->int_store[2]) \ + * GET_MODE_SIZE (MODE) / 4)))) /* A C expression for the cost of a branch instruction. A value of 1 is the default; other values are interpreted relative to that. */ |