From 65309b98346d2010170641afd3491a1a1dc45631 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Sat, 7 Mar 1998 01:43:32 +0000 Subject: [PATCH] (install_vif_length): Second pass at unpack len calcs. (s_endunpack): Round data up to word boundary. --- gas/ChangeLog | 2 ++ gas/config/tc-dvp.c | 23 +++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index e3b095a08f8..8d0e8824f6b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -3,6 +3,8 @@ Fri Mar 6 11:36:37 1998 Doug Evans * config/tc-dvp.c (s_endgif): Fix nloop calc and test. Warn if insufficient data present. Fix insertion of computed nloop value. + (install_vif_length): Second pass at unpack len calcs. + (s_endunpack): Round data up to word boundary. end-sanitize-sky start-sanitize-vr4320 diff --git a/gas/config/tc-dvp.c b/gas/config/tc-dvp.c index 7907161df25..c924bc431ef 100644 --- a/gas/config/tc-dvp.c +++ b/gas/config/tc-dvp.c @@ -1692,6 +1692,8 @@ cur_vif_insn_length () int byte_len; fragS *f; + /* FIXME: A better and less fragile way would be to use eval_expr. */ + if (cur_varlen_frag == frag_now) byte_len = frag_more (0) - cur_varlen_insn - 4; /* -4 for mpg itself */ else @@ -1740,11 +1742,19 @@ install_vif_length (buf, len) else if ((cmd & 0x60) == 0x60) { /* unpack */ - /* FIXME: revisit */ - /* ??? Worry about data /= 16 cuts off? */ - len /= 16; + /* Round up to a word boundary. */ + len = (len + 3) & ~3; + /* Compute value to insert. */ + len = vif_unpack_len_value (cmd & 15, len); + /* -1 is returned if wl,cl are unknown and thus we can't compute + a useful value */ + if (len == -1) + { + as_bad ("missing `stcycle', can't compute length of `unpack' insn"); + len = 1; + } if (len > 256) - as_bad ("`direct' data length must be between 1 and 256"); + as_bad ("`unpack' data length must be between 1 and 256"); len = len == 256 ? 0 : len; buf[2] = len; } @@ -2088,10 +2098,15 @@ s_endunpack (ignore) } byte_len = cur_vif_insn_length (); + /* Round up to next word boundary. */ + if (byte_len % 4) + frag_align (2, 0, 0); + #if 0 /* unpack doesn't support prespecifying a length */ if (cur_varlen_value * 16 != bytelen) as_warn ("length in `direct' instruction does not match length of data"); #endif + if (output_vif) install_vif_length (cur_varlen_insn, byte_len); -- 2.30.2