This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Aw: Re: [PATCH] Support VU0 on MIPS R5900
- From: "JÃrgen Urban" <JuergenUrban at gmx dot de>
- To: "Richard Sandiford" <rdsandiford at googlemail dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Mon, 5 Aug 2013 23:55:23 +0200 (CEST)
- Subject: Aw: Re: [PATCH] Support VU0 on MIPS R5900
- References: <20130108234130 dot 27410 at gmx dot net> <87a9rrso6l dot fsf at talisman dot default> <trinity-c3dc44a3-27c5-482b-b113-ca0cae29d590-1375046137093 at 3capp-gmx-bs55> <87mwp39mfo dot fsf at talisman dot default> <76A90B6E-700D-4EE8-9BD4-D7EAB1B0D7D6 at gmx dot de> <87ob9f6mc3 dot fsf at talisman dot default> <B714A516-F16E-45A1-9026-DFC325166486 at gmx dot de>, <87k3k17vxb dot fsf at talisman dot default>
- Sensitivity: Normal
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".
Can you please apply the attached patch?
Best regards
JÃrgen
Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.579
diff -u -p -r1.579 tc-mips.c
--- gas/config/tc-mips.c 4 Aug 2013 07:31:38 -0000 1.579
+++ gas/config/tc-mips.c 4 Aug 2013 22:31:40 -0000
@@ -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)
@@ -12324,6 +12324,13 @@ mips_lookup_insn (struct hash_control *h
if (insn && (insn->pinfo2 & INSN2_VU0_CHANNEL_SUFFIX) == 0)
return insn;
+ if (insn && (insn->pinfo2 & INSN2_VU0_CHANNEL_SUFFIX) != 0)
+ {
+ /* When no opcode suffix is specified, assume ".xyzw". */
+ *opcode_extra |= 0x0f << mips_vu0_channel_mask.lsb;
+ return insn;
+ }
+
dot = strchr (name, '.');
if (dot && dot[1])
{
@@ -12535,8 +12542,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.l
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/r5900-error-vu0.l,v
retrieving revision 1.1
diff -u -p -r1.1 r5900-error-vu0.l
--- gas/testsuite/gas/mips/r5900-error-vu0.l 4 Aug 2013 07:31:39 -0000 1.1
+++ gas/testsuite/gas/mips/r5900-error-vu0.l 4 Aug 2013 22:31:43 -0000
@@ -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-error-vu0.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/r5900-error-vu0.s,v
retrieving revision 1.1
diff -u -p -r1.1 r5900-error-vu0.s
--- gas/testsuite/gas/mips/r5900-error-vu0.s 4 Aug 2013 07:31:39 -0000 1.1
+++ gas/testsuite/gas/mips/r5900-error-vu0.s 4 Aug 2013 22:31:44 -0000
@@ -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-full-vu0.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/r5900-full-vu0.d,v
retrieving revision 1.1
diff -u -p -r1.1 r5900-full-vu0.d
--- gas/testsuite/gas/mips/r5900-full-vu0.d 4 Aug 2013 07:31:39 -0000 1.1
+++ gas/testsuite/gas/mips/r5900-full-vu0.d 4 Aug 2013 22:31:44 -0000
@@ -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: gas/testsuite/gas/mips/r5900-full-vu0.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/r5900-full-vu0.s,v
retrieving revision 1.1
diff -u -p -r1.1 r5900-full-vu0.s
--- gas/testsuite/gas/mips/r5900-full-vu0.s 4 Aug 2013 07:31:39 -0000 1.1
+++ gas/testsuite/gas/mips/r5900-full-vu0.s 4 Aug 2013 22:31:44 -0000
@@ -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: opcodes/mips-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/mips-opc.c,v
retrieving revision 1.113
diff -u -p -r1.113 mips-opc.c
--- opcodes/mips-opc.c 4 Aug 2013 07:31:38 -0000 1.113
+++ opcodes/mips-opc.c 4 Aug 2013 22:31:54 -0000
@@ -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 },