From: Adam Nemet Date: Mon, 20 Jul 2009 19:01:45 +0000 (+0000) Subject: mips.md (move_type): Add arith. X-Git-Tag: releases/gcc-4.5.0~4484 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=752fd2a8924c98f952f809991869ed5b1c255181;p=thirdparty%2Fgcc.git mips.md (move_type): Add arith. * config/mips/mips.md (move_type): Add arith. (type): Handle arith. (zero_extendsidi2): Rename this into ... (*zero_extendsidi2): ... this. Don't match if ISA_HAS_EXT_INS. (zero_extendsidi2): New expander. (*zero_extendsidi2_dext): New pattern. testsuite/ * gcc.target/mips/ext-3.c: New test. From-SVN: r149829 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b94b9d1175b3..c731df2529ae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-07-20 Adam Nemet + + * config/mips/mips.md (move_type): Add arith. + (type): Handle arith. + (zero_extendsidi2): Rename this into ... + (*zero_extendsidi2): ... this. Don't match if ISA_HAS_EXT_INS. + (zero_extendsidi2): New expander. + (*zero_extendsidi2_dext): New pattern. + 2009-07-20 Nick Clifton * config.gcc (mips64-*-*): Add definition of tm_defines in order diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index fc32c7586886..af429ca90f9c 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -313,7 +313,7 @@ ;; scheduling type to be "multi" instead. (define_attr "move_type" "unknown,load,fpload,store,fpstore,mtc,mfc,mthilo,mfhilo,move,fmove, - const,constN,signext,sll0,andi,loadpool,shift_shift,lui_movf" + const,constN,signext,arith,sll0,andi,loadpool,shift_shift,lui_movf" (const_string "unknown")) ;; Main data type used by the insn @@ -408,6 +408,7 @@ (eq_attr "move_type" "fmove") (const_string "fmove") (eq_attr "move_type" "loadpool") (const_string "load") (eq_attr "move_type" "signext") (const_string "signext") + (eq_attr "move_type" "arith") (const_string "arith") (eq_attr "move_type" "sll0") (const_string "shift") (eq_attr "move_type" "andi") (const_string "logical") @@ -2746,10 +2747,15 @@ ;; Extension insns. -(define_insn_and_split "zero_extendsidi2" +(define_expand "zero_extendsidi2" + [(set (match_operand:DI 0 "register_operand") + (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand")))] + "TARGET_64BIT") + +(define_insn_and_split "*zero_extendsidi2" [(set (match_operand:DI 0 "register_operand" "=d,d") (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,W")))] - "TARGET_64BIT" + "TARGET_64BIT && !ISA_HAS_EXT_INS" "@ # lwu\t%0,%1" @@ -2762,6 +2768,16 @@ [(set_attr "move_type" "shift_shift,load") (set_attr "mode" "DI")]) +(define_insn "*zero_extendsidi2_dext" + [(set (match_operand:DI 0 "register_operand" "=d,d") + (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,W")))] + "TARGET_64BIT && ISA_HAS_EXT_INS" + "@ + dext\t%0,%1,0,32 + lwu\t%0,%1" + [(set_attr "move_type" "arith,load") + (set_attr "mode" "DI")]) + ;; Combine is not allowed to convert this insn into a zero_extendsidi2 ;; because of TRULY_NOOP_TRUNCATION. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0a473c526db0..b7ba7d4f9747 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-07-20 Adam Nemet + + * gcc.target/mips/ext-3.c: New test. + 2009-07-20 Jakub Jelinek * gcc.dg/builtin-object-size-6.c: Adjust expected values. diff --git a/gcc/testsuite/gcc.target/mips/ext-3.c b/gcc/testsuite/gcc.target/mips/ext-3.c new file mode 100644 index 000000000000..557a8bc574ee --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/ext-3.c @@ -0,0 +1,14 @@ +/* For MIPS64r2 use DEXT rather than DSLL/DSRL to zero-extend. */ +/* { dg-do compile } */ +/* { dg-options "-O isa_rev>=2 -mgp64" } */ +/* { dg-final { scan-assembler "\tdext\t" } } */ +/* { dg-final { scan-assembler-not "sll" } } */ + +unsigned long long +f (unsigned *i) +{ + unsigned j = *i; + j >>= 1; /* enforce this is all done in SI mode */ + j++; /* don't merge the shift and the extension */ + return j; +}