From 6fa5b3907c5932477b6a16ed66bf980f1bbb53a1 Mon Sep 17 00:00:00 2001 From: Mark Dettinger Date: Sat, 22 Jan 2005 21:57:56 +0000 Subject: [PATCH] s390.c (struct processor_costs): New fields dlgr, dlr, dr, dsgfr, dsgr. 2005-01-21 Mark Dettinger * config/s390/s390.c (struct processor_costs): New fields dlgr, dlr, dr, dsgfr, dsgr. (z900_cost, z990_cost): Values for new fields. (s390_rtx_costs): New cases MEM und COMPARE in switch statement. Modified handling of SIGN_EXTEND, ZERO_EXTEND, DIV, MOD, UDIV, UMOD. From-SVN: r94079 --- gcc/ChangeLog | 9 +++++ gcc/config/s390/s390.c | 79 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 78 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5d3e5530bbb..3206c938f61 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2005-01-21 Mark Dettinger + + * config/s390/s390.c (struct processor_costs): New fields + dlgr, dlr, dr, dsgfr, dsgr. + (z900_cost, z990_cost): Values for new fields. + (s390_rtx_costs): New cases MEM und COMPARE in switch + statement. Modified handling of SIGN_EXTEND, ZERO_EXTEND, + DIV, MOD, UDIV, UMOD. + 2005-01-21 Ulrich Weigand * config/s390/s390.md ("doloop_si64"): Reload input value directly diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 6b72d6c23dd..41faff324a7 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -115,6 +115,11 @@ struct processor_costs const int ddr; const int debr; const int der; + const int dlgr; + const int dlr; + const int dr; + const int dsgfr; + const int dsgr; }; const struct processor_costs *s390_cost; @@ -143,6 +148,11 @@ struct processor_costs z900_cost = COSTS_N_INSNS (30), /* DDR */ COSTS_N_INSNS (27), /* DEBR */ COSTS_N_INSNS (26), /* DER */ + COSTS_N_INSNS (220), /* DLGR */ + COSTS_N_INSNS (34), /* DLR */ + COSTS_N_INSNS (34), /* DR */ + COSTS_N_INSNS (32), /* DSGFR */ + COSTS_N_INSNS (32), /* DSGR */ }; static const @@ -169,6 +179,11 @@ struct processor_costs z990_cost = COSTS_N_INSNS (44), /* DDR */ COSTS_N_INSNS (26), /* DDBR */ COSTS_N_INSNS (28), /* DER */ + COSTS_N_INSNS (176), /* DLGR */ + COSTS_N_INSNS (31), /* DLR */ + COSTS_N_INSNS (31), /* DR */ + COSTS_N_INSNS (31), /* DSGFR */ + COSTS_N_INSNS (31), /* DSGR */ }; @@ -1906,6 +1921,7 @@ s390_rtx_costs (rtx x, int code, int outer_code, int *total) case LABEL_REF: case SYMBOL_REF: case CONST_DOUBLE: + case MEM: *total = 0; return true; @@ -1998,8 +2014,38 @@ s390_rtx_costs (rtx x, int code, int outer_code, int *total) } return false; + case UDIV: + case UMOD: + if (GET_MODE (x) == TImode) /* 128 bit division */ + *total = s390_cost->dlgr; + else if (GET_MODE (x) == DImode) + { + rtx right = XEXP (x, 1); + if (GET_CODE (right) == ZERO_EXTEND) /* 64 by 32 bit division */ + *total = s390_cost->dlr; + else /* 64 by 64 bit division */ + *total = s390_cost->dlgr; + } + else if (GET_MODE (x) == SImode) /* 32 bit division */ + *total = s390_cost->dlr; + return false; + case DIV: - if (GET_MODE (x) == SFmode) + case MOD: + if (GET_MODE (x) == DImode) + { + rtx right = XEXP (x, 1); + if (GET_CODE (right) == ZERO_EXTEND) /* 64 by 32 bit division */ + if (TARGET_64BIT) + *total = s390_cost->dsgfr; + else + *total = s390_cost->dr; + else /* 64 by 64 bit division */ + *total = s390_cost->dsgr; + } + else if (GET_MODE (x) == SImode) /* 32 bit division */ + *total = s390_cost->dlr; + else if (GET_MODE (x) == SFmode) { if (TARGET_IEEE_FLOAT) *total = s390_cost->debr; @@ -2013,14 +2059,6 @@ s390_rtx_costs (rtx x, int code, int outer_code, int *total) else /* TARGET_IBM_FLOAT */ *total = s390_cost->ddr; } - else - *total = COSTS_N_INSNS (33); - return false; - - case UDIV: - case MOD: - case UMOD: - *total = COSTS_N_INSNS (33); return false; case SQRT: @@ -2032,10 +2070,31 @@ s390_rtx_costs (rtx x, int code, int outer_code, int *total) case SIGN_EXTEND: case ZERO_EXTEND: - if (outer_code == MULT) + if (outer_code == MULT || outer_code == DIV || outer_code == MOD + || outer_code == PLUS || outer_code == MINUS + || outer_code == COMPARE) *total = 0; return false; + case COMPARE: + *total = COSTS_N_INSNS (1); + if (GET_CODE (XEXP (x, 0)) == AND + && GET_CODE (XEXP (x, 1)) == CONST_INT + && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT) + { + rtx op0 = XEXP (XEXP (x, 0), 0); + rtx op1 = XEXP (XEXP (x, 0), 1); + rtx op2 = XEXP (x, 1); + + if (memory_operand (op0, GET_MODE (op0)) + && s390_tm_ccmode (op1, op2, 0) != VOIDmode) + return true; + if (register_operand (op0, GET_MODE (op0)) + && s390_tm_ccmode (op1, op2, 1) != VOIDmode) + return true; + } + return false; + default: return false; } -- 2.30.2