On Tue, 2015-05-12 at 05:21 +0000, Kumar, Venkataramanan wrote:
> Hi Steve, 
> 
> Yes this is expected.  As Segher pointed out, we need to change .md patterns 
> in
> target to be based on shifts instead of mults.
> 
> Regards,
> Venkat.

Here is my patch to change this.  I tested it with the
mips-mti-linux-gnu and mips-mti-elf targets and it fixed the MIPS
specific tests that were scanning for an lsa instruction and it also had
no regressions.

Since the lsa instruction was the only one using the 'y' operand code
and my change got rid of the only use of it, I removed it as part of
this patch.

Matthew or Catherine is this OK to checkin?

2015-05-12  Steve Ellcey  <sell...@imgtec.com>

        * config/mips/mips.c (mips_print_operand): Remove 'y' operand code.
        * config/mips/mips.md (<GPR:d>lsa): Rewrite with shift operator.
        * config/mips/predicates.md (const_immlsa_operand): Remove log call.

diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 16ed5f0..82d55b6 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -8440,7 +8440,6 @@ mips_print_operand_punct_valid_p (unsigned char code)
    'x' Print the low 16 bits of CONST_INT OP in hexadecimal format.
    'd' Print CONST_INT OP in decimal.
    'm' Print one less than CONST_INT OP in decimal.
-   'y' Print exact log2 of CONST_INT OP in decimal.
    'h' Print the high-part relocation associated with OP, after stripping
          any outermost HIGH.
    'R' Print the low-part relocation associated with OP.
@@ -8504,19 +8503,6 @@ mips_print_operand (FILE *file, rtx op, int letter)
        output_operand_lossage ("invalid use of '%%%c'", letter);
       break;
 
-    case 'y':
-      if (CONST_INT_P (op))
-       {
-         int val = exact_log2 (INTVAL (op));
-         if (val != -1)
-           fprintf (file, "%d", val);
-         else
-           output_operand_lossage ("invalid use of '%%%c'", letter);
-       }
-      else
-       output_operand_lossage ("invalid use of '%%%c'", letter);
-      break;
-
     case 'h':
       if (code == HIGH)
        op = XEXP (op, 0);
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index 76f2108..f6921c6 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -5528,11 +5528,11 @@
 
 (define_insn "<GPR:d>lsa"
  [(set (match_operand:GPR 0 "register_operand" "=d")
-       (plus:GPR (mult:GPR (match_operand:GPR 1 "register_operand" "d")
-                          (match_operand 2 "const_immlsa_operand" ""))
+       (plus:GPR (ashift:GPR (match_operand:GPR 1 "register_operand" "d")
+                            (match_operand 2 "const_immlsa_operand" ""))
                (match_operand:GPR 3 "register_operand" "d")))]
  "ISA_HAS_<GPR:D>LSA"
- "<GPR:d>lsa\t%0,%1,%3,%y2"
+ "<GPR:d>lsa\t%0,%1,%3,%2"
  [(set_attr "type" "arith")
   (set_attr "mode" "<GPR:MODE>")])
 
diff --git a/gcc/config/mips/predicates.md b/gcc/config/mips/predicates.md
index fa17ac7..4929c3d 100644
--- a/gcc/config/mips/predicates.md
+++ b/gcc/config/mips/predicates.md
@@ -35,7 +35,7 @@
 
 (define_predicate "const_immlsa_operand"
   (and (match_code "const_int")
-         (match_test "IN_RANGE (exact_log2 (INTVAL (op)), 1, 4)")))
+         (match_test "IN_RANGE (INTVAL (op), 1, 4)")))
 
 (define_predicate "const_uimm6_operand"
   (and (match_code "const_int")


Reply via email to