This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Aw: Re: [PATCH] Support VU0 on MIPS R5900


"JÃrgen Urban" <JuergenUrban@gmx.de> writes:
> Hello Richard,
>
>> >> Here's the patch I'd like to apply.  Does it look OK to you?
>> >
>> > The patch is OK and thanks for your work.
>> 
>> Thanks, now applied.
>
> I've some small improvements for VU0. The patch allows to omit the
> suffix when it is already known by the opcode. I detected that this was
> used in the old ps2sdk and I want it to be able to handle the old
> code. Further when no suffix was used for an opcode, the old toolchain
> activated all possible channels. This is xyzw for most opcodes and xyz
> for some opcodes like "vclipw".

Thanks, applied with one minor variation.  The INSN2_VU0_CHANNEL_SUFFIX
checks in mips_lookup_insn were there to make sure that a suffix was given.
Now that we're allowing the suffix to be omitted I think it makes more sense
to check in mips_ip instead.

Richard


opcodes/
2013-08-06  JÃrgen Urban  <JuergenUrban@gmx.de>

	* mips-opc.c (mips_builtin_opcodes): Add a suffixless version of
	VCLIPW.

gas/
2013-08-06  JÃrgen Urban  <JuergenUrban@gmx.de>

	* config/tc-mips.c (match_vu0_suffix_operand): Allow single-channel
	suffixes to be elided too.
	(mips_lookup_insn): Don't reject INSN2_VU0_CHANNEL_SUFFIX here.
	(mips_ip): Assume .xyzw if no VU0 suffix is specified.  Allow +N
	to be omitted too.

gas/testsuite/
2013-08-06  JÃrgen Urban  <JuergenUrban@gmx.de>

	* gas/mips/r5900-error-vu0.s, gas/mips/r5900-error-vu0.l,
	gas/mips/r5900-full-vu0.s, gas/mips/r5900-full-vu0.d: Allow
	single-channel suffixes to be elided.

Index: opcodes/mips-opc.c
===================================================================
--- opcodes/mips-opc.c	2013-08-04 08:30:54.544281898 +0100
+++ opcodes/mips-opc.c	2013-08-06 20:13:08.682925414 +0100
@@ -445,6 +445,7 @@ const struct mips_opcode mips_builtin_op
 {"vcallms",		"+f",		  0x4a000038, 0xffe0003f,	CP,		0,		VU0,		0,	0 },
 {"vcallmsr",		"+9",		  0x4a000039, 0xffff07ff,	CP,		0,		VU0,		0,	0 },
 {"vclipw.xyz",		"+6+K,+7+N",	  0x4bc001ff, 0xffe007ff,	CP,		0,		VU0,		0,	0 },
+{"vclipw",		"+6+K,+7+N",	  0x4bc001ff, 0xffe007ff,	CP,		0,		VU0,		0,	0 },
 {"vdiv",		"+q,+6+L,+7+M",	  0x4a0003bc, 0xfe0007ff,	CP,		0,		VU0,		0,	0 },
 {"vftoi0",		"+7+K,+6+K",	  0x4a00017c, 0xfe0007ff,	CP,		VU0CH,		VU0,		0,	0 },
 {"vftoi4",		"+7+K,+6+K",	  0x4a00017d, 0xfe0007ff,	CP,		VU0CH,		VU0,		0,	0 },
Index: gas/config/tc-mips.c
===================================================================
--- gas/config/tc-mips.c	2013-08-05 09:31:30.656156889 +0100
+++ gas/config/tc-mips.c	2013-08-06 20:14:33.198694600 +0100
@@ -5242,9 +5242,9 @@ match_vu0_suffix_operand (struct mips_ar
      (with X being 0).  */
   gas_assert (operand->size == 2 || operand->size == 4);
 
-  /* The suffix can be omitted when matching a previous 4-bit mask.  */
+  /* The suffix can be omitted when it is already part of the opcode.  */
   if (arg->token->type != OT_CHANNELS)
-    return operand->size == 4 && match_p;
+    return match_p;
 
   uval = arg->token->u.channels;
   if (operand->size == 2)
@@ -12321,7 +12321,7 @@ mips_lookup_insn (struct hash_control *h
 
   /* Look up the instruction as-is.  */
   insn = (struct mips_opcode *) hash_find (hash, name);
-  if (insn && (insn->pinfo2 & INSN2_VU0_CHANNEL_SUFFIX) == 0)
+  if (insn)
     return insn;
 
   dot = strchr (name, '.');
@@ -12359,7 +12359,7 @@ mips_lookup_insn (struct hash_control *h
 	{
 	  memcpy (name + opend - 2, name + opend, length - opend + 1);
 	  insn = (struct mips_opcode *) hash_find (hash, name);
-	  if (insn && (insn->pinfo2 & INSN2_VU0_CHANNEL_SUFFIX) == 0)
+	  if (insn)
 	    {
 	      forced_insn_length = suffix;
 	      return insn;
@@ -12422,6 +12422,9 @@ mips_ip (char *str, struct mips_cl_insn
       insn_error = _("Unrecognized opcode");
       return;
     }
+  /* When no opcode suffix is specified, assume ".xyzw". */
+  if ((insn->pinfo2 & INSN2_VU0_CHANNEL_SUFFIX) != 0 && opcode_extra == 0)
+    opcode_extra = 0xf << mips_vu0_channel_mask.lsb;
 
   if (strcmp (insn->name, "li.s") == 0)
     format = 'f';
@@ -12535,8 +12538,15 @@ mips_ip (char *str, struct mips_cl_insn
 	      if (strcmp (args, "(b)") == 0)
 		args += 3;
 
-	      if (args[0] == '+' && args[1] == 'K')
-		args += 2;
+	      if (args[0] == '+')
+	        switch (args[1])
+		  {
+		    case 'K':
+		    case 'N':
+		      /* The register suffix is optional. */
+		      args += 2;
+		      break;
+		  }
 
 	      /* Fail the match if there were too few operands.  */
 	      if (*args)
Index: gas/testsuite/gas/mips/r5900-error-vu0.s
===================================================================
--- gas/testsuite/gas/mips/r5900-error-vu0.s	2013-08-04 08:30:54.542281846 +0100
+++ gas/testsuite/gas/mips/r5900-error-vu0.s	2013-08-06 20:13:08.681925405 +0100
@@ -77,7 +77,6 @@ text_label:
 	vaddaz.xy	$ACCxyz, $vf0xy, $vf31z
 	vaddaz.y	$ACCx, $vf31y, $vf0z
 	vaddaz.yw	$ACCyw, $vf0yw, $a0
-	vaddaz.yw	$ACC, $0, $31
 	vaddi.w		$vf0w, $vf31w, $Q
 	vaddi.w		$vf1w, $vf2w, $R
 	vaddi.w		$vf31w, $vf0w, $ACC
@@ -641,7 +640,6 @@ text_label:
 	vsubax.w	$ACCx, $vf31x, $vf0x
 	vsubax.xyzw	$ACCxyzw, $vf31xyzw, $vf0xyzw
 	vsubax.xzw	$ACCxzw, $vf1xzw, $vf2xzw
-	vsubax.y	$ACCy, $vf1y, $vf2
 	vsubax.y	$ACCy, $vf31y, $vf0y
 	vsubax.yw	$ACCyw, $vf0yw, $vf0yw
 	vsubay.yw	$ACCyw, $vf0yw, $vf31yw
Index: gas/testsuite/gas/mips/r5900-error-vu0.l
===================================================================
--- gas/testsuite/gas/mips/r5900-error-vu0.l	2013-08-04 08:30:54.541281819 +0100
+++ gas/testsuite/gas/mips/r5900-error-vu0.l	2013-08-06 20:13:08.680925396 +0100
@@ -71,7 +71,6 @@
 .*: Error: Illegal operands `vaddaz\.xy \$ACCxyz,\$vf0xy,\$vf31z'
 .*: Error: Illegal operands `vaddaz\.y \$ACCx,\$vf31y,\$vf0z'
 .*: Error: Illegal operands `vaddaz\.yw \$ACCyw,\$vf0yw,\$a0'
-.*: Error: Illegal operands `vaddaz\.yw \$ACC,\$0,\$31'
 .*: Error: Illegal operands `vaddi\.w \$vf0w,\$vf31w,\$Q'
 .*: Error: Illegal operands `vaddi\.w \$vf1w,\$vf2w,\$R'
 .*: Error: Illegal operands `vaddi\.w \$vf31w,\$vf0w,\$ACC'
@@ -637,7 +636,6 @@
 .*: Error: Illegal operands `vsubax\.w \$ACCx,\$vf31x,\$vf0x'
 .*: Error: Illegal operands `vsubax\.xyzw \$ACCxyzw,\$vf31xyzw,\$vf0xyzw'
 .*: Error: Illegal operands `vsubax\.xzw \$ACCxzw,\$vf1xzw,\$vf2xzw'
-.*: Error: Illegal operands `vsubax\.y \$ACCy,\$vf1y,\$vf2'
 .*: Error: Illegal operands `vsubax\.y \$ACCy,\$vf31y,\$vf0y'
 .*: Error: Illegal operands `vsubax\.yw \$ACCyw,\$vf0yw,\$vf0yw'
 .*: Error: Illegal operands `vsubay\.yw \$ACCyw,\$vf0yw,\$vf31yw'
Index: gas/testsuite/gas/mips/r5900-full-vu0.s
===================================================================
--- gas/testsuite/gas/mips/r5900-full-vu0.s	2013-08-04 08:30:54.542281846 +0100
+++ gas/testsuite/gas/mips/r5900-full-vu0.s	2013-08-06 20:13:08.681925405 +0100
@@ -25,7 +25,8 @@ text_label:
 	vcallms	0xff8
 	vcallmsr	$vi27
 	vclipw.xyz	$vf31xyz,$vf1w
-	vdiv	$Q,$vf1y,$vf11x
+	vclipw		$vf31xyz,$vf1w
+	vdiv		$Q,$vf1y,$vf11x
 	vftoi0.xyzw	$vf0xyzw,$vf31xyzw
 	vftoi4.xyzw	$vf0xyzw,$vf31xyzw
 	vftoi12.xyzw	$vf0xyzw,$vf31xyzw
@@ -56,12 +57,15 @@ text_label:
 	vmaddx.xyzw	$vf10xyzw,$vf31xyzw,$vf1x
 	vmaddy.xyzw	$vf10xyzw,$vf31xyzw,$vf1y
 	vmaddz.xyzw	$vf10xyzw,$vf31xyzw,$vf1z
+	vmaddz		$vf6, $vf3, $vf5
 	vmadda.xyzw	$ACCxyzw,$vf31xyzw,$vf0xyzw
 	vmaddai.xyzw	$ACCxyzw,$vf31xyzw,$I
 	vmaddaq.xyzw	$ACCxyzw,$vf31xyzw,$Q
 	vmaddaw.xyzw	$ACCxyzw,$vf31xyzw,$vf1w
 	vmaddax.xyzw	$ACCxyzw,$vf31xyzw,$vf1x
+	vmaddax		$ACC, $vf1, $vf5
 	vmadday.xyzw	$ACCxyzw,$vf31xyzw,$vf1y
+	vmadday		$ACC, $vf2, $vf5
 	vmaddaz.xyzw	$ACCxyzw,$vf31xyzw,$vf1z
 	vmax.xyzw	$vf10xyzw,$vf31xyzw,$vf0xyzw
 	vmaxi.xyzw	$vf10xyzw,$vf31xyzw,$I
@@ -104,6 +108,7 @@ text_label:
 	vmulai.xyzw	$ACCxyzw,$vf31xyzw,$I
 	vmulaq.xyzw	$ACCxyzw,$vf31xyzw,$Q
 	vmulaw.xyzw	$ACCxyzw,$vf31xyzw,$vf1w
+	vmulaw		$ACC, $vf4, $vf0
 	vmulax.xyzw	$ACCxyzw,$vf31xyzw,$vf1x
 	vmulay.xyzw	$ACCxyzw,$vf31xyzw,$vf1y
 	vmulaz.xyzw	$ACCxyzw,$vf31xyzw,$vf1z
Index: gas/testsuite/gas/mips/r5900-full-vu0.d
===================================================================
--- gas/testsuite/gas/mips/r5900-full-vu0.d	2013-08-04 08:30:54.542281846 +0100
+++ gas/testsuite/gas/mips/r5900-full-vu0.d	2013-08-06 20:13:08.681925405 +0100
@@ -25,6 +25,7 @@ Disassembly of section \.text:
 [0-9a-f]+ <[^>]*> 4a007ff8 	vcallms	0xff8
 [0-9a-f]+ <[^>]*> 4a00d839 	vcallmsr	\$vi27
 [0-9a-f]+ <[^>]*> 4bc1f9ff 	vclipw\.xyz	\$vf31xyz,\$vf1w
+[0-9a-f]+ <[^>]*> 4bc1f9ff 	vclipw\.xyz	\$vf31xyz,\$vf1w
 [0-9a-f]+ <[^>]*> 4a2b0bbc 	vdiv	\$Q,\$vf1y,\$vf11x
 [0-9a-f]+ <[^>]*> 4be0f97c 	vftoi0\.xyzw	\$vf0xyzw,\$vf31xyzw
 [0-9a-f]+ <[^>]*> 4be0f97d 	vftoi4\.xyzw	\$vf0xyzw,\$vf31xyzw
@@ -56,12 +57,15 @@ Disassembly of section \.text:
 [0-9a-f]+ <[^>]*> 4be1fa88 	vmaddx\.xyzw	\$vf10xyzw,\$vf31xyzw,\$vf1x
 [0-9a-f]+ <[^>]*> 4be1fa89 	vmaddy\.xyzw	\$vf10xyzw,\$vf31xyzw,\$vf1y
 [0-9a-f]+ <[^>]*> 4be1fa8a 	vmaddz\.xyzw	\$vf10xyzw,\$vf31xyzw,\$vf1z
+[0-9a-f]+ <[^>]*> 4be5198a 	vmaddz\.xyzw	\$vf6xyzw,\$vf3xyzw,\$vf5z
 [0-9a-f]+ <[^>]*> 4be0fabd 	vmadda\.xyzw	\$ACCxyzw,\$vf31xyzw,\$vf0xyzw
 [0-9a-f]+ <[^>]*> 4be0fa3f 	vmaddai\.xyzw	\$ACCxyzw,\$vf31xyzw,\$I
 [0-9a-f]+ <[^>]*> 4be0fa3d 	vmaddaq\.xyzw	\$ACCxyzw,\$vf31xyzw,\$Q
 [0-9a-f]+ <[^>]*> 4be1f8bf 	vmaddaw\.xyzw	\$ACCxyzw,\$vf31xyzw,\$vf1w
 [0-9a-f]+ <[^>]*> 4be1f8bc 	vmaddax\.xyzw	\$ACCxyzw,\$vf31xyzw,\$vf1x
+[0-9a-f]+ <[^>]*> 4be508bc 	vmaddax\.xyzw	\$ACCxyzw,\$vf1xyzw,\$vf5x
 [0-9a-f]+ <[^>]*> 4be1f8bd 	vmadday\.xyzw	\$ACCxyzw,\$vf31xyzw,\$vf1y
+[0-9a-f]+ <[^>]*> 4be510bd 	vmadday\.xyzw	\$ACCxyzw,\$vf2xyzw,\$vf5y
 [0-9a-f]+ <[^>]*> 4be1f8be 	vmaddaz\.xyzw	\$ACCxyzw,\$vf31xyzw,\$vf1z
 [0-9a-f]+ <[^>]*> 4be0faab 	vmax\.xyzw	\$vf10xyzw,\$vf31xyzw,\$vf0xyzw
 [0-9a-f]+ <[^>]*> 4be0fa9d 	vmaxi\.xyzw	\$vf10xyzw,\$vf31xyzw,\$I
@@ -104,6 +108,7 @@ Disassembly of section \.text:
 [0-9a-f]+ <[^>]*> 4be0f9fe 	vmulai\.xyzw	\$ACCxyzw,\$vf31xyzw,\$I
 [0-9a-f]+ <[^>]*> 4be0f9fc 	vmulaq\.xyzw	\$ACCxyzw,\$vf31xyzw,\$Q
 [0-9a-f]+ <[^>]*> 4be1f9bf 	vmulaw\.xyzw	\$ACCxyzw,\$vf31xyzw,\$vf1w
+[0-9a-f]+ <[^>]*> 4be021bf 	vmulaw\.xyzw	\$ACCxyzw,\$vf4xyzw,\$vf0w
 [0-9a-f]+ <[^>]*> 4be1f9bc 	vmulax\.xyzw	\$ACCxyzw,\$vf31xyzw,\$vf1x
 [0-9a-f]+ <[^>]*> 4be1f9bd 	vmulay\.xyzw	\$ACCxyzw,\$vf31xyzw,\$vf1y
 [0-9a-f]+ <[^>]*> 4be1f9be 	vmulaz\.xyzw	\$ACCxyzw,\$vf31xyzw,\$vf1z


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]