aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAdam Nemet <anemet@caviumnetworks.com>2009-07-20 19:01:45 +0000
committerAdam Nemet <nemet@gcc.gnu.org>2009-07-20 19:01:45 +0000
commit752fd2a8924c98f952f809991869ed5b1c255181 (patch)
tree20a1d6516fe650a22b13ea5d2bfb343b0dae6183 /gcc
parent621114bc7b373c9597a455125d3d5e06fd9c548e (diff)
downloadgcc-752fd2a8924c98f952f809991869ed5b1c255181.zip
gcc-752fd2a8924c98f952f809991869ed5b1c255181.tar.gz
gcc-752fd2a8924c98f952f809991869ed5b1c255181.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/mips/mips.md22
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/mips/ext-3.c14
4 files changed, 46 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b94b9d1..c731df2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2009-07-20 Adam Nemet <anemet@caviumnetworks.com>
+
+ * 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 <nickc@redhat.com>
* 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 fc32c75..af429ca 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 0a473c5..b7ba7d4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-20 Adam Nemet <anemet@caviumnetworks.com>
+
+ * gcc.target/mips/ext-3.c: New test.
+
2009-07-20 Jakub Jelinek <jakub@redhat.com>
* 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 0000000..557a8bc
--- /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;
+}