* config/tc-dvp.c (parse_float): New function.

(assemble_vu): Handle loi insns.
	(assemble_one_insn): Simplify suffix parsing.
	Handle DVP_OPERAND_FLOAT.
This commit is contained in:
Doug Evans 1998-02-18 23:56:15 +00:00
parent 1b4817e3c3
commit 19f12fb41c
2 changed files with 74 additions and 56 deletions

View File

@ -1,3 +1,12 @@
start-sanitize-sky
Wed Feb 18 15:49:56 1998 Doug Evans <devans@canuck.cygnus.com>
* config/tc-dvp.c (parse_float): New function.
(assemble_vu): Handle loi insns.
(assemble_one_insn): Simplify suffix parsing.
Handle DVP_OPERAND_FLOAT.
end-sanitize-sky
start-sanitize-m32rx start-sanitize-m32rx
Wed Feb 18 14:30:26 1998 Nick Clifton <nickc@cygnus.com> Wed Feb 18 14:30:26 1998 Nick Clifton <nickc@cygnus.com>
@ -14,10 +23,11 @@ Wed Feb 18 14:30:26 1998 Nick Clifton <nickc@cygnus.com>
Wed Feb 18 11:00:18 1998 Nick Clifton <nickc@cygnus.com> Wed Feb 18 11:00:18 1998 Nick Clifton <nickc@cygnus.com>
* app.c: Parse || as a seperator between assembler statements. * app.c: Parse || as a seperator between assembler statements.
end-sanitize-m32rx end-sanitize-m32rx
Tue Feb 17 18:58:51 1998 Doug Evans <devans@seba.cygnus.com> Tue Feb 17 18:58:51 1998 Doug Evans <devans@seba.cygnus.com>
* cen.c (cgen_md_apply_fix3): Delete call to validate_operand. * cgen.c (cgen_md_apply_fix3): Delete call to validate_operand.
Test result of insert_operand for error. Test result of insert_operand for error.
start-sanitize-m32rx start-sanitize-m32rx

View File

@ -28,6 +28,8 @@
#include "opcode/dvp.h" #include "opcode/dvp.h"
#include "elf/mips.h" #include "elf/mips.h"
static long parse_float PARAMS ((char **, const char **));
static long parse_dma_ild_autocount (); static long parse_dma_ild_autocount ();
static long parse_dma_ptr_autocount (); static long parse_dma_ptr_autocount ();
@ -55,7 +57,7 @@ const char FLT_CHARS[] = "dD";
be provided. (e.g. mpg is followed by vu insns until a .EndMpg is be provided. (e.g. mpg is followed by vu insns until a .EndMpg is
seen). */ seen). */
typedef enum { typedef enum {
ASM_INIT, ASM_MPG, ASM_DIRECT, ASM_UNPACK, ASM_GIF, ASM_VU ASM_INIT, ASM_MPG, ASM_DIRECT, ASM_UNPACK, ASM_VU
} asm_state; } asm_state;
static asm_state cur_asm_state = ASM_INIT; static asm_state cur_asm_state = ASM_INIT;
@ -144,9 +146,8 @@ const pseudo_typeS md_pseudo_table[] =
{ "endgif", s_endgif, 0 }, { "endgif", s_endgif, 0 },
{ "endmpg", s_endmpg, 0 }, { "endmpg", s_endmpg, 0 },
{ "endunpack", s_endunpack, 0 }, { "endunpack", s_endunpack, 0 },
/* .vu,.gif added to simplify debugging */ /* .vu added to simplify debugging and creation of input files */
{ "vu", s_state, ASM_VU }, { "vu", s_state, ASM_VU },
{ "gif", s_state, ASM_GIF },
{ NULL, NULL, 0 } { NULL, NULL, 0 }
}; };
@ -224,11 +225,11 @@ md_assemble (str)
{ {
if (strncasecmp (str, "dma", 3) == 0) if (strncasecmp (str, "dma", 3) == 0)
assemble_dma (str); assemble_dma (str);
if (strncasecmp (str, "gif", 3) == 0)
assemble_gif (str);
else else
assemble_vif (str); assemble_vif (str);
} }
else if (cur_asm_state == ASM_GIF)
assemble_gif (str);
else if (cur_asm_state == ASM_VU else if (cur_asm_state == ASM_VU
|| cur_asm_state == ASM_MPG) || cur_asm_state == ASM_MPG)
assemble_vu (str); assemble_vu (str);
@ -453,22 +454,22 @@ assemble_vu (str)
vu_upper_opcode_lookup_asm (str), vu_operands, vu_upper_opcode_lookup_asm (str), vu_operands,
&str, f + 4); &str, f + 4);
*p = '|'; *p = '|';
if (opcode == NULL)
return;
str = p + 1; str = p + 1;
assemble_vu_insn (DVP_VULO,
vu_lower_opcode_lookup_asm (str), vu_operands,
&str, f);
#else #else
opcode = assemble_vu_insn (DVP_VUUP, opcode = assemble_vu_insn (DVP_VUUP,
vu_upper_opcode_lookup_asm (str), vu_operands, vu_upper_opcode_lookup_asm (str), vu_operands,
&str, f + 4); &str, f + 4);
/* Don't assemble next one if we couldn't assemble the first. */
if (opcode)
assemble_vu_insn (DVP_VULO,
vu_lower_opcode_lookup_asm (str), vu_operands,
&str, f);
#endif #endif
/* Don't assemble next one if we couldn't assemble the first. */
if (opcode == NULL)
return;
opcode = assemble_vu_insn (DVP_VULO,
vu_lower_opcode_lookup_asm (str), vu_operands,
&str, f);
/* If this was the "loi" pseudo-insn, we need to set the `i' bit. */
if (strcmp (opcode->mnemonic, "loi") == 0)
f[7] |= 0x80;
} }
static const dvp_opcode * static const dvp_opcode *
@ -617,9 +618,6 @@ assemble_one_insn (cpu, opcode, operand_table, pstr, insn_buf)
/* Are we finished with suffixes? */ /* Are we finished with suffixes? */
else if (!past_opcode_p) else if (!past_opcode_p)
{ {
int found;
char c;
char *s,*t;
long suf_value; long suf_value;
if (!(operand->flags & DVP_OPERAND_SUFFIX)) if (!(operand->flags & DVP_OPERAND_SUFFIX))
@ -634,21 +632,10 @@ assemble_one_insn (cpu, opcode, operand_table, pstr, insn_buf)
continue; continue;
} }
s = str; /* Parse the suffix. */
/* Pick the suffix out and parse it. */
/* ??? Hmmm ... there may not be any need to nul-terminate the
string, and it may in fact complicate things. */
for (t = (*s == '.' || *s == '/' || *s == '[') ? s + 1 : s;
*t && (isalnum (*t) || *t == ']');
++t)
continue;
c = *t;
*t = '\0';
errmsg = NULL; errmsg = NULL;
suf_value = (*operand->parse) (opcode, operand, mods, &s, suf_value = (*operand->parse) (opcode, operand, mods, &str,
&errmsg); &errmsg);
*t = c;
if (errmsg) if (errmsg)
{ {
/* This can happen, for example, in ARC's in "blle foo" and /* This can happen, for example, in ARC's in "blle foo" and
@ -662,10 +649,6 @@ assemble_one_insn (cpu, opcode, operand_table, pstr, insn_buf)
insert_operand (cpu, opcode, operand, mods, insn_buf, insert_operand (cpu, opcode, operand, mods, insn_buf,
(offsetT) suf_value, &errmsg); (offsetT) suf_value, &errmsg);
/* FIXME: For suffixes that have a null "" value,
this next line is wrong as we will skip over something
we're not supposed to. */
str = t;
++syn; ++syn;
} }
else else
@ -690,12 +673,12 @@ assemble_one_insn (cpu, opcode, operand_table, pstr, insn_buf)
} }
#endif #endif
if( operand->flags & DVP_OPERAND_DMA_ILD) if (operand->flags & DVP_OPERAND_DMA_ILD)
{ {
s_dmadata_implied( 0); s_dmadata_implied (0);
++syn; ++syn;
break; break;
} }
/* Is there anything left to parse? /* Is there anything left to parse?
We don't check for this at the top because we want to parse We don't check for this at the top because we want to parse
@ -705,18 +688,29 @@ assemble_one_insn (cpu, opcode, operand_table, pstr, insn_buf)
break; break;
/* Parse the operand. */ /* Parse the operand. */
if( operand->flags & DVP_OPERAND_DMA_ILD_AUTOCOUNT) if (operand->flags & DVP_OPERAND_FLOAT)
{ {
errmsg = 0; errmsg = 0;
value = parse_dma_ild_autocount( opcode, operand, mods, insn_buf, &str, &errmsg); value = parse_float (&str, &errmsg);
if( errmsg) break; if (errmsg)
} break;
else if( operand->flags & DVP_OPERAND_DMA_PTR_AUTOCOUNT) }
{ else if (operand->flags & DVP_OPERAND_DMA_ILD_AUTOCOUNT)
{
errmsg = 0; errmsg = 0;
value = parse_dma_ptr_autocount( opcode, operand, mods, insn_buf, &str, &errmsg); value = parse_dma_ild_autocount (opcode, operand, mods,
if( errmsg) break; insn_buf, &str, &errmsg);
} if (errmsg)
break;
}
else if (operand->flags & DVP_OPERAND_DMA_PTR_AUTOCOUNT)
{
errmsg = 0;
value = parse_dma_ptr_autocount (opcode, operand, mods,
insn_buf, &str, &errmsg);
if (errmsg)
break;
}
else if (operand->parse) else if (operand->parse)
{ {
errmsg = NULL; errmsg = NULL;
@ -1129,9 +1123,24 @@ md_atof (type, litP, sizeP)
return 0; return 0;
} }
/* /* Parse a 32 bit floating point number.
Compute the auto-count value for a DMA tag with inline data. The result is those 32 bits as an integer. */
*/
static long
parse_float (pstr, errmsg)
char **pstr;
const char **errmsg;
{
LITTLENUM_TYPE words[MAX_LITTLENUMS];
char *p;
p = atof_ieee (*pstr, 'f', words);
*pstr = p;
return (words[0] << 16) | words[1];
}
/* Compute the auto-count value for a DMA tag with inline data. */
static long static long
parse_dma_ild_autocount( opcode, operand, mods, insn_buf, pstr, errmsg) parse_dma_ild_autocount( opcode, operand, mods, insn_buf, pstr, errmsg)
const dvp_opcode *opcode; const dvp_opcode *opcode;
@ -1167,9 +1176,8 @@ scan_symbol( sym)
return sym; return sym;
} }
/* /* Compute the auto-count value for a DMA tag with out-of-line data. */
Compute the auto-count value for a DMA tag with out-of-line data.
*/
static long static long
parse_dma_ptr_autocount( opcode, operand, mods, insn_buf, pstr, errmsg) parse_dma_ptr_autocount( opcode, operand, mods, insn_buf, pstr, errmsg)
const dvp_opcode *opcode; const dvp_opcode *opcode;