Commit 53c98b1f by DJ Delorie Committed by DJ Delorie

read-rtl.c (ISDIGIT, ISSPACE): Make sure we have these.

* read-rtl.c (ISDIGIT, ISSPACE): Make sure we have these.
(validate_const_int): New.
(read_rtx): Validate constant integers.
* config/i386/i386.md (pmulhrwv4hi3): Use decimal constants.

From-SVN: r47187
parent 8b97450d
2001-11-19 DJ Delorie <dj@redhat.com>
* read-rtl.c (ISDIGIT, ISSPACE): Make sure we have these.
(validate_const_int): New.
(read_rtx): Validate constant integers.
* config/i386/i386.md (pmulhrwv4hi3): Use decimal constants.
2001-11-19 Jakub Jelinek <jakub@redhat.com> 2001-11-19 Jakub Jelinek <jakub@redhat.com>
* doc/hostconfig.texi (DUMPFILE_FORMAT): Move into the table. * doc/hostconfig.texi (DUMPFILE_FORMAT): Move into the table.
......
...@@ -19676,10 +19676,10 @@ ...@@ -19676,10 +19676,10 @@
(sign_extend:V4SI (sign_extend:V4SI
(match_operand:V4HI 2 "nonimmediate_operand" "ym"))) (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
(vec_const:V4SI (vec_const:V4SI
(parallel [(const_int 0x8000) (parallel [(const_int 32768)
(const_int 0x8000) (const_int 32768)
(const_int 0x8000) (const_int 32768)
(const_int 0x8000)]))) (const_int 32768)])))
(const_int 16))))] (const_int 16))))]
"TARGET_3DNOW" "TARGET_3DNOW"
"pmulhrw\\t{%2, %0|%0, %2}" "pmulhrw\\t{%2, %0|%0, %2}"
......
...@@ -25,6 +25,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -25,6 +25,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "obstack.h" #include "obstack.h"
#include "hashtab.h" #include "hashtab.h"
#ifndef ISDIGIT
#include <ctype.h>
#define ISDIGIT isdigit
#define ISSPACE isspace
#endif
#define obstack_chunk_alloc xmalloc #define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free #define obstack_chunk_free free
...@@ -41,6 +47,7 @@ static void read_escape PARAMS ((struct obstack *, FILE *)); ...@@ -41,6 +47,7 @@ static void read_escape PARAMS ((struct obstack *, FILE *));
static unsigned def_hash PARAMS ((const void *)); static unsigned def_hash PARAMS ((const void *));
static int def_name_eq_p PARAMS ((const void *, const void *)); static int def_name_eq_p PARAMS ((const void *, const void *));
static void read_constants PARAMS ((FILE *infile, char *tmp_char)); static void read_constants PARAMS ((FILE *infile, char *tmp_char));
static void validate_const_int PARAMS ((FILE *, const char *));
/* Subroutines of read_rtx. */ /* Subroutines of read_rtx. */
...@@ -494,6 +501,28 @@ traverse_md_constants (callback, info) ...@@ -494,6 +501,28 @@ traverse_md_constants (callback, info)
htab_traverse (md_constants, callback, info); htab_traverse (md_constants, callback, info);
} }
static void
validate_const_int (infile, string)
FILE *infile;
const char *string;
{
const char *cp;
int valid = 1;
cp = string;
while (*cp && ISSPACE(*cp))
cp++;
if (*cp == '-' || *cp == '+')
cp++;
if (*cp == 0)
valid = 0;
for (; *cp; cp++)
if (! ISDIGIT (*cp))
valid = 0;
if (!valid)
fatal_with_file_and_line (infile, "invalid decimal constant \"%s\"\n", string);
}
/* Read an rtx in printed representation from INFILE /* Read an rtx in printed representation from INFILE
and return an actual rtx in core constructed accordingly. and return an actual rtx in core constructed accordingly.
read_rtx is not used in the compiler proper, but rather in read_rtx is not used in the compiler proper, but rather in
...@@ -699,6 +728,7 @@ again: ...@@ -699,6 +728,7 @@ again:
case 'w': case 'w':
read_name (tmp_char, infile); read_name (tmp_char, infile);
validate_const_int(infile, tmp_char);
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
tmp_wide = atoi (tmp_char); tmp_wide = atoi (tmp_char);
#else #else
...@@ -720,6 +750,7 @@ again: ...@@ -720,6 +750,7 @@ again:
case 'i': case 'i':
case 'n': case 'n':
read_name (tmp_char, infile); read_name (tmp_char, infile);
validate_const_int(infile, tmp_char);
tmp_int = atoi (tmp_char); tmp_int = atoi (tmp_char);
XINT (return_rtx, i) = tmp_int; XINT (return_rtx, i) = tmp_int;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment