Bug 15220 - MIPS/Loongson 2F: Wrong opcodes for madd.ps/msub.ps/nmadd.ps/nmsub.ps
Summary: MIPS/Loongson 2F: Wrong opcodes for madd.ps/msub.ps/nmadd.ps/nmsub.ps
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.23
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-02 13:18 UTC by Aaro Koskinen
Modified: 2014-03-04 22:01 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaro Koskinen 2013-03-02 13:18:57 UTC
opcodes/mips-opc.c has wrong opcodes for the following INSN_LOONGSON_2F / IL2F instructions:

madd.ps
msub.ps
nmadd.ps
nmsub.ps

The format field (25:21) should be 22 instead of 11.

This is probably caused by a documentation error in Loongson2FUserGuide (http://dev.lemote.com/files/resource/documents/Loongson/ls2f/). The table in page 96 shows the format for paired-single is 11, while the table in the page 157 tells it's 22.

Based on tests on 2F HW, 22 is the correct one.

The bug was originally discovered by Mark H Weaver and reported
here: https://groups.google.com/forum/?fromgroups=#!topic/loongson-dev/VZ1yR9Tsr7o
Comment 1 Sourceware Commits 2013-07-25 19:11:41 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	rsandifo@sourceware.org	2013-07-25 19:11:39

Modified files:
	opcodes        : mips-opc.c ChangeLog 
	gas/testsuite/gas/mips: loongson-2f.d 
	gas/testsuite  : ChangeLog 

Log message:
	opcodes/
	2013-07-25  Aaro Koskinen  <aaro.koskinen@iki.fi>
	
	PR gas/15220
	* mips-opc.c (mips_builtin_opcodes): Fix wrong opcodes for
	Loongson 2F madd.ps, msub.ps, nmadd.ps and nmsub.ps.
	
	gas/testsuite/
	* gas/mips/loongson-2f.d: Fix expected output for madd.ps,
	msub.ps, nmadd.ps and nmsub.ps.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/mips-opc.c.diff?cvsroot=src&r1=1.107&r2=1.108
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/ChangeLog.diff?cvsroot=src&r1=1.1998&r2=1.1999
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/mips/loongson-2f.d.diff?cvsroot=src&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2278&r2=1.2279
Comment 2 Richard Sandiford 2014-03-04 22:01:23 UTC
Patch applied a few months ago, but I forgot to close this.