From: Adam Nemet Date: Fri, 31 Jul 2009 15:47:20 +0000 (+0000) Subject: mips.md (*clear_upper32_dext): New pattern. X-Git-Tag: releases/gcc-4.5.0~4229 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1732047792af977668ac7c1d93571b489e767c60;p=thirdparty%2Fgcc.git mips.md (*clear_upper32_dext): New pattern. * config/mips/mips.md (*clear_upper32_dext): New pattern. testsuite/ * gcc.target/mips/ext-4.c: New test. From-SVN: r150316 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9357738ca0a4..17a3e969c9fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2009-07-31 Adam Nemet + + * config/mips/mips.md (*clear_upper32_dext): New pattern. + 2009-07-31 Uros Bizjak * config/i386/bsd.h (ASM_BYTE): New define. diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index af429ca90f9c..02e99375195c 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -2785,7 +2785,7 @@ [(set (match_operand:DI 0 "register_operand" "=d,d") (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,W") (const_int 4294967295)))] - "TARGET_64BIT" + "TARGET_64BIT && !ISA_HAS_EXT_INS" { if (which_alternative == 0) return "#"; @@ -2802,6 +2802,21 @@ [(set_attr "move_type" "shift_shift,load") (set_attr "mode" "DI")]) +(define_insn "*clear_upper32_dext" + [(set (match_operand:DI 0 "register_operand" "=d,d") + (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,W") + (const_int 4294967295)))] + "TARGET_64BIT && ISA_HAS_EXT_INS" +{ + if (which_alternative == 0) + return "dext\t%0,%1,0,32"; + + operands[1] = gen_lowpart (SImode, operands[1]); + return "lwu\t%0,%1"; +} + [(set_attr "move_type" "arith,load") + (set_attr "mode" "DI")]) + (define_expand "zero_extend2" [(set (match_operand:GPR 0 "register_operand") (zero_extend:GPR (match_operand:SHORT 1 "nonimmediate_operand")))] diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c38a075b4ae1..2cfe47bff1b3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-07-31 Adam Nemet + + * gcc.target/mips/ext-4.c: New test. + 2009-07-30 Sebastian Pop * g++.dg/tree-ssa/pr33615.C: Fix pattern for lim. diff --git a/gcc/testsuite/gcc.target/mips/ext-4.c b/gcc/testsuite/gcc.target/mips/ext-4.c new file mode 100644 index 000000000000..15e20292b1b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/ext-4.c @@ -0,0 +1,11 @@ +/* For MIPS64r2 use DEXT rather than DSLL/DSRL for clear_upper32. */ +/* { 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 long long i) +{ + return i & 0xffffffffull; +}