diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2008-12-21 21:43:51 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2008-12-21 21:43:51 +0000 |
commit | 26b69f64820b553e6e5b00122b41e8c53277a95e (patch) | |
tree | 818d1f76fcd9055b6365f381013bb34b90e68e50 /gcc | |
parent | 50220190d24a251bba53c1eb6cf54ae6979d38b6 (diff) | |
download | gcc-26b69f64820b553e6e5b00122b41e8c53277a95e.zip gcc-26b69f64820b553e6e5b00122b41e8c53277a95e.tar.gz gcc-26b69f64820b553e6e5b00122b41e8c53277a95e.tar.bz2 |
mips-dsp.md (mips_lbux): Turn into a define_expand, changing operand 1 to a pmode_register_operand.
gcc/
* config/mips/mips-dsp.md (mips_lbux): Turn into a define_expand,
changing operand 1 to a pmode_register_operand.
(mips_lhx, mips_lwx): Likewise.
(mips_lbux_<mode>, mips_lhx_<mode>, mips_lwx_<mode>): New patterns.
* config/mips/mips.c (mips_prepare_builtin_arg): Get the mode of
the value from the argument expression.
From-SVN: r142872
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config/mips/mips-dsp.md | 66 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 18 |
3 files changed, 73 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 17054a9..628277d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2008-12-21 Richard Sandiford <rdsandiford@googlemail.com> + + * config/mips/mips-dsp.md (mips_lbux): Turn into a define_expand, + changing operand 1 to a pmode_register_operand. + (mips_lhx, mips_lwx): Likewise. + (mips_lbux_<mode>, mips_lhx_<mode>, mips_lwx_<mode>): New patterns. + * config/mips/mips.c (mips_prepare_builtin_arg): Get the mode of + the value from the argument expression. + 2008-12-21 Jan Hubicka <jh@suse.cz> Kai Tietz <kai.tietz@onevision.com> diff --git a/gcc/config/mips/mips-dsp.md b/gcc/config/mips/mips-dsp.md index 9a70b66..f846b3d 100644 --- a/gcc/config/mips/mips-dsp.md +++ b/gcc/config/mips/mips-dsp.md @@ -1008,32 +1008,72 @@ ;; Table 2-7. MIPS DSP ASE Instructions: Indexed-Load ;; L*X -(define_insn "mips_lbux" +(define_expand "mips_lbux" + [(match_operand:SI 0 "register_operand") + (match_operand 1 "pmode_register_operand") + (match_operand:SI 2 "register_operand")] + "ISA_HAS_DSP" +{ + operands[2] = convert_to_mode (Pmode, operands[2], false); + if (Pmode == SImode) + emit_insn (gen_mips_lbux_si (operands[0], operands[1], operands[2])); + else + emit_insn (gen_mips_lbux_di (operands[0], operands[1], operands[2])); + DONE; +}) + +(define_insn "mips_lbux_<mode>" [(set (match_operand:SI 0 "register_operand" "=d") - (zero_extend:SI (mem:QI (plus:SI (match_operand:SI 1 - "register_operand" "d") - (match_operand:SI 2 - "register_operand" "d")))))] + (zero_extend:SI + (mem:QI (plus:P (match_operand:P 1 "register_operand" "d") + (match_operand:P 2 "register_operand" "d")))))] "ISA_HAS_DSP" "lbux\t%0,%2(%1)" [(set_attr "type" "load") (set_attr "mode" "SI")]) -(define_insn "mips_lhx" +(define_expand "mips_lhx" + [(match_operand:SI 0 "register_operand") + (match_operand 1 "pmode_register_operand") + (match_operand:SI 2 "register_operand")] + "ISA_HAS_DSP" +{ + operands[2] = convert_to_mode (Pmode, operands[2], false); + if (Pmode == SImode) + emit_insn (gen_mips_lhx_si (operands[0], operands[1], operands[2])); + else + emit_insn (gen_mips_lhx_di (operands[0], operands[1], operands[2])); + DONE; +}) + +(define_insn "mips_lhx_<mode>" [(set (match_operand:SI 0 "register_operand" "=d") - (sign_extend:SI (mem:HI (plus:SI (match_operand:SI 1 - "register_operand" "d") - (match_operand:SI 2 - "register_operand" "d")))))] + (zero_extend:SI + (mem:HI (plus:P (match_operand:P 1 "register_operand" "d") + (match_operand:P 2 "register_operand" "d")))))] "ISA_HAS_DSP" "lhx\t%0,%2(%1)" [(set_attr "type" "load") (set_attr "mode" "SI")]) -(define_insn "mips_lwx" +(define_expand "mips_lwx" + [(match_operand:SI 0 "register_operand") + (match_operand 1 "pmode_register_operand") + (match_operand:SI 2 "register_operand")] + "ISA_HAS_DSP" +{ + operands[2] = convert_to_mode (Pmode, operands[2], false); + if (Pmode == SImode) + emit_insn (gen_mips_lwx_si (operands[0], operands[1], operands[2])); + else + emit_insn (gen_mips_lwx_di (operands[0], operands[1], operands[2])); + DONE; +}) + +(define_insn "mips_lwx_<mode>" [(set (match_operand:SI 0 "register_operand" "=d") - (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "d") - (match_operand:SI 2 "register_operand" "d"))))] + (mem:SI (plus:P (match_operand:P 1 "register_operand" "d") + (match_operand:P 2 "register_operand" "d"))))] "ISA_HAS_DSP" "lwx\t%0,%2(%1)" [(set_attr "type" "load") diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index d74f490..290caa6 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -11682,19 +11682,23 @@ static rtx mips_prepare_builtin_arg (enum insn_code icode, unsigned int opno, tree exp, unsigned int argno) { + tree arg; rtx value; enum machine_mode mode; - value = expand_normal (CALL_EXPR_ARG (exp, argno)); + arg = CALL_EXPR_ARG (exp, argno); + value = expand_normal (arg); mode = insn_data[icode].operand[opno].mode; if (!insn_data[icode].operand[opno].predicate (value, mode)) { - /* Cope with address operands, where MODE is not the mode of - VALUE itself. */ - if (GET_MODE (value) == VOIDmode) - value = copy_to_mode_reg (mode, value); - else - value = copy_to_reg (value); + /* We need to get the mode from ARG for two reasons: + + - to cope with address operands, where MODE is the mode of the + memory, rather than of VALUE itself. + + - to cope with special predicates like pmode_register_operand, + where MODE is VOIDmode. */ + value = copy_to_mode_reg (TYPE_MODE (TREE_TYPE (arg)), value); /* Check the predicate again. */ if (!insn_data[icode].operand[opno].predicate (value, mode)) |