include/opcode/
authorRichard Sandiford <rdsandiford@googlemail.com>
Sun, 7 Jul 2013 10:00:43 +0000 (10:00 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Sun, 7 Jul 2013 10:00:43 +0000 (10:00 +0000)
* mips.h: Update documentation of "+s" and "+S".

opcodes/
* mips-opc.c (mips_builtin_opcodes): Use "+s" for "cins32" and
"+S" for "cins".
* mips-dis.c (print_mips_arg): Update "+s" and "+S" comments.
Combine cases.

gas/
* config/tc-mips.c (mips_ip): Preserve the real bit number for "+p".
Require the msb to be <= 31 for "+s".  Check that the size is <= 31
for both "+s" and "+S".

gas/ChangeLog
gas/config/tc-mips.c
include/opcode/ChangeLog
include/opcode/mips.h
opcodes/ChangeLog
opcodes/mips-dis.c
opcodes/mips-opc.c

index 3450c839c21772c8c3f41d082fbf1542c03af89e..6b60e2d7da39404ed5a8a571f0b6c605c53b2b65 100644 (file)
@@ -1,3 +1,9 @@
+2013-07-07  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * config/tc-mips.c (mips_ip): Preserve the real bit number for "+p".
+       Require the msb to be <= 31 for "+s".  Check that the size is <= 31
+       for both "+s" and "+S".
+
 2013-07-07  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * config/tc-mips.c (validate_mips_insn, validate_micromips_insn):
index 9d058afb8913de16436802386e15385663f7fac9..7acb5e25fc5382e64db0ca9059dbfd516ed0b9b7 100644 (file)
@@ -12016,8 +12016,7 @@ mips_ip (char *str, struct mips_cl_insn *ip)
                              (unsigned long) imm_expr.X_add_number);
                      imm_expr.X_add_number = 0;
                    }
-                 /* Make the pos explicit to simplify +S.  */
-                 lastpos = imm_expr.X_add_number + 32;
+                 lastpos = imm_expr.X_add_number;
                  INSERT_OPERAND (0, CINSPOS, *ip, imm_expr.X_add_number);
                  imm_expr.X_op = O_absent;
                  s = expr_end;
@@ -12039,11 +12038,12 @@ mips_ip (char *str, struct mips_cl_insn *ip)
                  continue;
 
                case 's':
-                 /* cins and exts length-minus-one field.  */
+                 /* cins32 and exts32 length-minus-one field.  */
                  gas_assert (!mips_opts.micromips);
                  my_getExpression (&imm_expr, s);
                  check_absolute_expr (ip, &imm_expr);
-                 if ((unsigned long) imm_expr.X_add_number > 31)
+                 if ((unsigned long) imm_expr.X_add_number > 31
+                     || (unsigned long) imm_expr.X_add_number + lastpos > 31)
                    {
                      as_bad (_("Improper size (%lu)"),
                              (unsigned long) imm_expr.X_add_number);
@@ -12055,12 +12055,11 @@ mips_ip (char *str, struct mips_cl_insn *ip)
                  continue;
 
                case 'S':
-                 /* cins32/exts32 and cins/exts aliasing cint32/exts32
-                    length-minus-one field.  */
+                 /* cins/exts length-minus-one field.  */
                  gas_assert (!mips_opts.micromips);
                  my_getExpression (&imm_expr, s);
                  check_absolute_expr (ip, &imm_expr);
-                 if ((long) imm_expr.X_add_number < 0
+                 if ((unsigned long) imm_expr.X_add_number > 31
                      || (unsigned long) imm_expr.X_add_number + lastpos > 63)
                    {
                      as_bad (_("Improper size (%lu)"),
index b2b718cb49c19d3ac22852cb554ad6e5309590bb..b3bee6f36d8d035b56eee4993940bf2cfe124298 100644 (file)
@@ -1,3 +1,7 @@
+2013-07-07  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * mips.h: Update documentation of "+s" and "+S".
+
 2013-07-07  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * mips.h: Document "+i".
index d25b1368700916245a7fa8d5c7b14bcdf9460c70..b583a51f4092a5c789b1a83feb68c2fdfe3dae6e 100644 (file)
@@ -508,11 +508,10 @@ struct mips_opcode
    "+P" Position field of cins/exts aliasing cins32/exts32.  Matches if
        32 <= pos < 64, otherwise skips to next candidate.
    "+Q" Immediate field of seqi/snei.  Enforces -512 <= imm < 512.
-   "+s" Length-minus-one field of cins/exts.  Enforces: 0 <= lenm1 < 32.
-   "+S" Length-minus-one field of cins32/exts32 or cins/exts aliasing
-       cint32/exts32.  Enforces non-negative value and that
-       pos + lenm1 < 32 or pos + lenm1 < 64 depending whether previous
-       position field is "+p" or "+P".
+   "+s" Length-minus-one field of cins32/exts32.  Requires msb position
+       of the field to be <= 31.
+   "+S" Length-minus-one field of cins/exts.  Requires msb position
+       of the field to be <= 63.
 
    Loongson-3A:
    "+a" 8-bit signed offset in bit 6 (OP_*_OFFSET_A)
index 68b263f3c32bc71b42db56a01c5fd2e8ed7bd438..4521f91c7dbff3666916faf03da39a533b540f10 100644 (file)
@@ -1,3 +1,10 @@
+2013-07-07  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * mips-opc.c (mips_builtin_opcodes): Use "+s" for "cins32" and
+       "+S" for "cins".
+       * mips-dis.c (print_mips_arg): Update "+s" and "+S" comments.
+       Combine cases.
+
 2013-07-07  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * mips-opc.c (mips_builtin_opcodes): Use "+i" rather than "a" for
index 9ef7247bf2343d4f31be4b86a5e502fffba7444b..5777232b938b9fc553524240460562390350359b 100644 (file)
@@ -1072,11 +1072,8 @@ print_insn_args (const char *d,
              infprintf (is, "0x%x", GET_OP (l, CINSPOS));
              break;
 
-           case 's':           /* cins and exts length-minus-one */
-             infprintf (is, "0x%x", GET_OP (l, CINSLM1));
-             break;
-
-           case 'S':           /* cins32 and exts32 length-minus-one field */
+           case 's':           /* cins32 and exts32 length-minus-one */
+           case 'S':           /* cins and exts length-minus-one field */
              infprintf (is, "0x%x", GET_OP (l, CINSLM1));
              break;
 
index 6d709ee5a329b23909ac139550df04dd096610ac..26ecea4d6eb3e636e3df116ccc8983806895c933 100644 (file)
@@ -625,9 +625,9 @@ const struct mips_opcode mips_builtin_opcodes[] =
 {"cftc1",   "d,E",     0x41000023, 0xffe007ff, TRAP|LCD|WR_d|RD_C1|FP_S, 0,            0,      MT32    },
 {"cftc1",   "d,T",     0x41000023, 0xffe007ff, TRAP|LCD|WR_d|RD_C1|FP_S, 0,            0,      MT32    },
 {"cftc2",   "d,E",     0x41000025, 0xffe007ff, TRAP|LCD|WR_d|RD_C2,    0,              0,      MT32,   IOCT|IOCTP|IOCT2        },
-{"cins32",  "t,r,+p,+S",0x70000033, 0xfc00003f, WR_t|RD_s,             0,              IOCT    },
+{"cins32",  "t,r,+p,+s",0x70000033, 0xfc00003f, WR_t|RD_s,             0,              IOCT    },
 {"cins",    "t,r,+P,+S",0x70000033, 0xfc00003f, WR_t|RD_s,             0,              IOCT    }, /* cins32 */
-{"cins",    "t,r,+p,+s",0x70000032, 0xfc00003f, WR_t|RD_s,             0,              IOCT    },
+{"cins",    "t,r,+p,+S",0x70000032, 0xfc00003f, WR_t|RD_s,             0,              IOCT    },
 {"clo",     "U,s",      0x70000021, 0xfc0007ff, WR_d|WR_t|RD_s,        0,              I32|N55 },
 {"clz",     "U,s",      0x70000020, 0xfc0007ff, WR_d|WR_t|RD_s,        0,              I32|N55 },
 {"ctc0",    "t,G",     0x40c00000, 0xffe007ff, COD|RD_t|WR_CC,         0,              I1,     0,      IOCT|IOCTP|IOCT2        },
@@ -813,9 +813,9 @@ const struct mips_opcode mips_builtin_opcodes[] =
 {"evpe",    "",                0x41600021, 0xffffffff, TRAP,                   0,              0,      MT32    },
 {"evpe",    "t",       0x41600021, 0xffe0ffff, TRAP|WR_t,              0,              0,      MT32    },
 {"ext",     "t,r,+A,+C", 0x7c000000, 0xfc00003f, WR_t|RD_s,                    0,              I33     },
-{"exts32",  "t,r,+p,+S",0x7000003b, 0xfc00003f, WR_t|RD_s,             0,              IOCT    },
+{"exts32",  "t,r,+p,+s",0x7000003b, 0xfc00003f, WR_t|RD_s,             0,              IOCT    },
 {"exts",    "t,r,+P,+S",0x7000003b, 0xfc00003f, WR_t|RD_s,             0,              IOCT    }, /* exts32 */
-{"exts",    "t,r,+p,+s",0x7000003a, 0xfc00003f, WR_t|RD_s,             0,              IOCT    },
+{"exts",    "t,r,+p,+S",0x7000003a, 0xfc00003f, WR_t|RD_s,             0,              IOCT    },
 {"floor.l.d", "D,S",   0x4620000b, 0xffff003f, WR_D|RD_S|FP_D,         0,              I3_33   },
 {"floor.l.s", "D,S",   0x4600000b, 0xffff003f, WR_D|RD_S|FP_S|FP_D,    0,              I3_33   },
 {"floor.w.d", "D,S",   0x4620000f, 0xffff003f, WR_D|RD_S|FP_S|FP_D,    0,              I2,     0,      SF      },