aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/mips/mips32-dspr2/dps_w_ph.c
diff options
context:
space:
mode:
authorPetar Jovanovic <petarj@mips.com>2013-01-02 05:08:48 +0100
committerAurelien Jarno <aurelien@aurel32.net>2013-01-08 11:58:43 +0100
commitda1a4cef9e125a866f4ef9a39b342c2913727f70 (patch)
tree092e0885cbf1a508ba049c2de1761a3a6d6956e6 /tests/tcg/mips/mips32-dspr2/dps_w_ph.c
parente320d05a531ed4991a87cfe0a4c280563fb88788 (diff)
target-mips: Fix helper and tests for dot/cross-dot product instructions
Helper function for dpa_w_ph, dpax_w_ph, dps_w_ph and dpsx_w_ph incorrectly defines halfword vector elements as unsigned values. This results in wrong output which is not triggered in the tests as they also follow this logic. Signed-off-by: Petar Jovanovic <petarj@mips.com> Reviewed-by: Eric Johnson <ericj@mips.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'tests/tcg/mips/mips32-dspr2/dps_w_ph.c')
-rw-r--r--tests/tcg/mips/mips32-dspr2/dps_w_ph.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/tcg/mips/mips32-dspr2/dps_w_ph.c b/tests/tcg/mips/mips32-dspr2/dps_w_ph.c
index 8303643d18..f51f9b9d13 100644
--- a/tests/tcg/mips/mips32-dspr2/dps_w_ph.c
+++ b/tests/tcg/mips/mips32-dspr2/dps_w_ph.c
@@ -23,5 +23,22 @@ int main()
assert(ach == resulth);
assert(acl == resultl);
+ ach = 6, acl = 7;
+ rs = 0xFFFF00FF;
+ rt = 0xFFFF0002;
+ resulth = 0x05;
+ resultl = 0xFFFFFE08;
+ __asm
+ ("mthi %0, $ac1\n\t"
+ "mtlo %1, $ac1\n\t"
+ "dps.w.ph $ac1, %2, %3\n\t"
+ "mfhi %0, $ac1\n\t"
+ "mflo %1, $ac1\n\t"
+ : "+r"(ach), "+r"(acl)
+ : "r"(rs), "r"(rt)
+ );
+ assert(ach == resulth);
+ assert(acl == resultl);
+
return 0;
}