MIPS queue for December 2018 - v3

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJcLj4bAAoJENSXKoln91plJ3MH/RauD4z1smuHP2LBRqtUgFEv
 +pZxNtmHQGcpJ6QexYzldcGR4gPgiBW6AYO3qVFSduwNWO7UjOPBAl/fKvlz5pWL
 BJw9odsrOXjG/6cXcy3QWkYxizC/0/HzPjWa3/sSa3Dkygib9jB80wzR3ZpFreLo
 XQsbcwso4aaoB0X1M4tfHsY6xUcxmzB+V73xFh2ptHrMTGoCZJbo12Np0rdwEa9v
 WMV9wn1ptB3R0QJNxA2X+vbnJsXujG15DZC7Wj1HUmz9LcLG5doTCGXLXOxD0zhy
 6HKB/bVTvbDdDti17JvbmtdVhzgoLMtnQFly0e77px3XRMonQHMpsQGCIvWyd+g=
 =y41H
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-december-2018-v3' into staging

MIPS queue for December 2018 - v3

# gpg: Signature made Thu 03 Jan 2019 16:53:47 GMT
# gpg:                using RSA key D4972A8967F75A65
# gpg: Good signature from "Aleksandar Markovic <amarkovic@wavecomp.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8526 FBF1 5DA3 811F 4A01  DD75 D497 2A89 67F7 5A65

* remotes/amarkovic/tags/mips-queue-december-2018-v3: (44 commits)
  tests/tcg: mips: Test R5900 three-operand MADDU1
  tests/tcg: mips: Test R5900 three-operand MADDU
  tests/tcg: mips: Test R5900 three-operand MADD1
  tests/tcg: mips: Test R5900 three-operand MADD
  disas: nanoMIPS: Add a note on documentation
  disas: nanoMIPS: Reorder declarations and definitions of gpr decoders
  disas: nanoMIPS: Comment the decoder of 'gpr1' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr1' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr2.reg2' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr2.reg2' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr2.reg1' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr2.reg1' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr4.zero' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr4.zero' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr4' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr4' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr3.src.store' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr3.src.store' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr3' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr3' gpr encoding type
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-01-04 10:11:18 +00:00
commit 8ecede4681
8 changed files with 2206 additions and 1311 deletions

View File

@ -205,21 +205,24 @@ F: disas/microblaze.c
MIPS MIPS
M: Aurelien Jarno <aurelien@aurel32.net> M: Aurelien Jarno <aurelien@aurel32.net>
M: Aleksandar Markovic <amarkovic@wavecomp.com> M: Aleksandar Markovic <amarkovic@wavecomp.com>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
R: Stefan Markovic <smarkovic@wavecomp.com> R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained S: Maintained
F: target/mips/ F: target/mips/
F: default-configs/*mips*
F: disas/mips.c
F: disas/nanomips.cpp
F: disas/nanomips.h
F: hw/intc/mips_gic.c
F: hw/mips/ F: hw/mips/
F: hw/misc/mips_* F: hw/misc/mips_*
F: hw/intc/mips_gic.c
F: hw/timer/mips_gictimer.c F: hw/timer/mips_gictimer.c
F: include/hw/intc/mips_gic.h
F: include/hw/mips/ F: include/hw/mips/
F: include/hw/misc/mips_* F: include/hw/misc/mips_*
F: include/hw/intc/mips_gic.h
F: include/hw/timer/mips_gictimer.h F: include/hw/timer/mips_gictimer.h
F: tests/tcg/mips/ F: tests/tcg/mips/
F: disas/mips.c K: ^Subject:.*(?i)mips
F: disas/nanomips.h
F: disas/nanomips.cpp
Moxie Moxie
M: Anthony Green <green@moxielogic.com> M: Anthony Green <green@moxielogic.com>
@ -361,6 +364,7 @@ F: target/arm/kvm.c
MIPS MIPS
M: James Hogan <jhogan@kernel.org> M: James Hogan <jhogan@kernel.org>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
R: Stefan Markovic <smarkovic@wavecomp.com> R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained S: Maintained
F: target/mips/kvm.c F: target/mips/kvm.c
@ -870,6 +874,7 @@ MIPS Machines
------------- -------------
Jazz Jazz
M: Hervé Poussineau <hpoussin@reactos.org> M: Hervé Poussineau <hpoussin@reactos.org>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
R: Stefan Markovic <smarkovic@wavecomp.com> R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained S: Maintained
F: hw/mips/mips_jazz.c F: hw/mips/mips_jazz.c
@ -878,12 +883,14 @@ F: hw/dma/rc4030.c
Malta Malta
M: Aurelien Jarno <aurelien@aurel32.net> M: Aurelien Jarno <aurelien@aurel32.net>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
R: Stefan Markovic <smarkovic@wavecomp.com> R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained S: Maintained
F: hw/mips/mips_malta.c F: hw/mips/mips_malta.c
Mipssim Mipssim
M: Aleksandar Markovic <amarkovic@wavecomp.com> M: Aleksandar Markovic <amarkovic@wavecomp.com>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
R: Stefan Markovic <smarkovic@wavecomp.com> R: Stefan Markovic <smarkovic@wavecomp.com>
S: Odd Fixes S: Odd Fixes
F: hw/mips/mips_mipssim.c F: hw/mips/mips_mipssim.c
@ -891,12 +898,14 @@ F: hw/net/mipsnet.c
R4000 R4000
M: Aurelien Jarno <aurelien@aurel32.net> M: Aurelien Jarno <aurelien@aurel32.net>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
R: Stefan Markovic <smarkovic@wavecomp.com> R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained S: Maintained
F: hw/mips/mips_r4k.c F: hw/mips/mips_r4k.c
Fulong 2E Fulong 2E
M: Aleksandar Markovic <amarkovic@wavecomp.com> M: Aleksandar Markovic <amarkovic@wavecomp.com>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
R: Stefan Markovic <smarkovic@wavecomp.com> R: Stefan Markovic <smarkovic@wavecomp.com>
S: Odd Fixes S: Odd Fixes
F: hw/mips/mips_fulong2e.c F: hw/mips/mips_fulong2e.c
@ -906,6 +915,7 @@ F: include/hw/isa/vt82c686.h
Boston Boston
M: Paul Burton <pburton@wavecomp.com> M: Paul Burton <pburton@wavecomp.com>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
R: Stefan Markovic <smarkovic@wavecomp.com> R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained S: Maintained
F: hw/core/loader-fit.c F: hw/core/loader-fit.c
@ -2162,6 +2172,7 @@ F: disas/i386.c
MIPS target MIPS target
M: Aurelien Jarno <aurelien@aurel32.net> M: Aurelien Jarno <aurelien@aurel32.net>
R: Aleksandar Rikalo <arikalo@wavecomp.com>
R: Stefan Markovic <smarkovic@wavecomp.com> R: Stefan Markovic <smarkovic@wavecomp.com>
S: Maintained S: Maintained
F: tcg/mips/ F: tcg/mips/

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
/* /*
* Header file for nanoMIPS disassembler component of QEMU * Header file for nanoMIPS disassembler component of QEMU
* *
* Copyright (C) 2018 Wave Computing * Copyright (C) 2018 Wave Computing, Inc.
* Copyright (C) 2018 Matthew Fortune <matthew.fortune@mips.com> * Copyright (C) 2018 Matthew Fortune <matthew.fortune@mips.com>
* Copyright (C) 2018 Aleksandar Markovic <aleksandar.markovic@wavecomp.com> * Copyright (C) 2018 Aleksandar Markovic <amarkovic@wavecomp.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -17,6 +17,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/ */
#ifndef NANOMIPS_DISASSEMBLER_H #ifndef NANOMIPS_DISASSEMBLER_H
@ -24,14 +25,14 @@
#include <string> #include <string>
typedef unsigned short uint16; typedef int64_t int64;
typedef unsigned int uint32; typedef uint64_t uint64;
typedef long long int64; typedef uint32_t uint32;
typedef unsigned long long uint64; typedef uint16_t uint16;
namespace img namespace img
{ {
typedef unsigned long long address; typedef uint64_t address;
} }
@ -104,13 +105,14 @@ private:
uint64 renumber_registers(uint64 index, uint64 *register_list, uint64 renumber_registers(uint64 index, uint64 *register_list,
size_t register_list_size); size_t register_list_size);
uint64 encode_gpr3(uint64 d);
uint64 encode_gpr3_store(uint64 d); uint64 decode_gpr_gpr4(uint64 d);
uint64 encode_rd1_from_rd(uint64 d); uint64 decode_gpr_gpr4_zero(uint64 d);
uint64 encode_gpr4_zero(uint64 d); uint64 decode_gpr_gpr3(uint64 d);
uint64 encode_gpr4(uint64 d); uint64 decode_gpr_gpr3_src_store(uint64 d);
uint64 encode_rd2_reg1(uint64 d); uint64 decode_gpr_gpr2_reg1(uint64 d);
uint64 encode_rd2_reg2(uint64 d); uint64 decode_gpr_gpr2_reg2(uint64 d);
uint64 decode_gpr_gpr1(uint64 d);
uint64 copy(uint64 d); uint64 copy(uint64 d);
int64 copy(int64 d); int64 copy(int64 d);
@ -142,20 +144,20 @@ private:
std::string CPR(uint64 reg); std::string CPR(uint64 reg);
std::string ADDRESS(uint64 value, int instruction_size); std::string ADDRESS(uint64 value, int instruction_size);
int64 extract_s_4_2_1_0(uint64 instruction); int64 extract_s__se3_4_2_1_0(uint64 instruction);
int64 extr_sil0il0bs8_il15il8bs1Tmsb8(uint64 instruction); int64 extract_s__se7_0_6_5_4_3_2_1_s1(uint64 instruction);
int64 extr_sil0il10bs1_il1il1bs9Tmsb10(uint64 instruction); int64 extract_s__se8_15_7_6_5_4_3_s3(uint64 instruction);
int64 extr_sil0il11bs1_il1il1bs10Tmsb11(uint64 instruction); int64 extract_s__se8_15_7_6_5_4_3_2_s2(uint64 instruction);
int64 extr_sil0il14bs1_il1il1bs13Tmsb14(uint64 instruction); int64 extract_s__se8_15_7_6_5_4_3_2_1_0(uint64 instruction);
int64 extr_sil0il16bs16_il16il0bs16Tmsb31(uint64 instruction); int64 extract_s__se9_20_19_18_17_16_15_14_13_12_11(uint64 instruction);
int64 extr_sil0il21bs1_il1il1bs20Tmsb21(uint64 instruction); int64 extract_s__se10_0_9_8_7_6_5_4_3_2_1_s1(uint64 instruction);
int64 extr_sil0il25bs1_il1il1bs24Tmsb25(uint64 instruction); int64 extract_s__se11_0_10_9_8_7_6_5_4_3_2_1_0_s1(uint64 instruction);
int64 extr_sil0il31bs1_il2il21bs10_il12il12bs9Tmsb31(uint64 instruction); int64 extract_s__se14_0_13_to_1_s1(uint64 instruction);
int64 extr_sil0il7bs1_il1il1bs6Tmsb7(uint64 instruction); int64 extract_s__se21_0_20_to_1_s1(uint64 instruction);
int64 extr_sil11il0bs10Tmsb9(uint64 instruction); int64 extract_s__se25_0_24_to_1_s1(uint64 instruction);
int64 extract_shift_21_20_19_18_17_16(uint64 instruction); int64 extract_s__se31_15_to_0_31_to_16(uint64 instruction);
int64 extr_sil2il2bs6_il15il8bs1Tmsb8(uint64 instruction); int64 extract_s__se31_0_11_to_2_20_to_12_s12(uint64 instruction);
int64 extr_sil3il3bs5_il15il8bs1Tmsb8(uint64 instruction); int64 extract_shift__se5_21_20_19_18_17_16(uint64 instruction);
uint64 extract_ac_13_12(uint64 instruction); uint64 extract_ac_13_12(uint64 instruction);
uint64 extract_bit_16_15_14_13_12_11(uint64 instruction); uint64 extract_bit_16_15_14_13_12_11(uint64 instruction);
@ -175,10 +177,10 @@ private:
uint64 extract_ct_25_24_23_22_21(uint64 instruction); uint64 extract_ct_25_24_23_22_21(uint64 instruction);
uint64 extract_eu_3_2_1_0(uint64 instruction); uint64 extract_eu_3_2_1_0(uint64 instruction);
uint64 extract_eu_6_5_4_3_2_1_0(uint64 instruction); uint64 extract_eu_6_5_4_3_2_1_0(uint64 instruction);
uint64 extract_fd_10_9_8_7_6(uint64 instruction); uint64 extract_fd_15_14_13_12_11(uint64 instruction);
uint64 extract_fs_15_14_13_12_11(uint64 instruction); uint64 extract_fs_20_19_18_17_16(uint64 instruction);
uint64 extract_ft_15_14_13_12_11(uint64 instruction); uint64 extract_ft_15_14_13_12_11(uint64 instruction);
uint64 extract_ft_20_19_18_17_16(uint64 instruction); uint64 extract_ft_25_24_23_22_21(uint64 instruction);
uint64 extract_gp_2(uint64 instruction); uint64 extract_gp_2(uint64 instruction);
uint64 extract_hint_25_24_23_22_21(uint64 instruction); uint64 extract_hint_25_24_23_22_21(uint64 instruction);
uint64 extract_hs_20_19_18_17_16(uint64 instruction); uint64 extract_hs_20_19_18_17_16(uint64 instruction);
@ -190,7 +192,7 @@ private:
uint64 extract_rdl_25_24(uint64 instruction); uint64 extract_rdl_25_24(uint64 instruction);
uint64 extract_rd2_3_8(uint64 instruction); uint64 extract_rd2_3_8(uint64 instruction);
uint64 extract_rd3_3_2_1(uint64 instruction); uint64 extract_rd3_3_2_1(uint64 instruction);
uint64 extract_rd_20_19_18_17_16(uint64 instruction); uint64 extract_rd_15_14_13_12_11(uint64 instruction);
uint64 extract_rs3_6_5_4(uint64 instruction); uint64 extract_rs3_6_5_4(uint64 instruction);
uint64 extract_rs4_4_2_1_0(uint64 instruction); uint64 extract_rs4_4_2_1_0(uint64 instruction);
uint64 extract_rs_4_3_2_1_0(uint64 instruction); uint64 extract_rs_4_3_2_1_0(uint64 instruction);
@ -217,7 +219,7 @@ private:
uint64 extract_shift_20_19_18_17_16(uint64 instruction); uint64 extract_shift_20_19_18_17_16(uint64 instruction);
uint64 extract_shift_10_9_8_7_6(uint64 instruction); uint64 extract_shift_10_9_8_7_6(uint64 instruction);
uint64 extract_shiftx_11_10_9_8_7_6(uint64 instruction); uint64 extract_shiftx_11_10_9_8_7_6(uint64 instruction);
uint64 extr_shiftxil7il1bs4Fmsb4(uint64 instruction); uint64 extract_shiftx_10_9_8_7__s1(uint64 instruction);
uint64 extract_size_20_19_18_17_16(uint64 instruction); uint64 extract_size_20_19_18_17_16(uint64 instruction);
uint64 extract_stripe_6(uint64 instruction); uint64 extract_stripe_6(uint64 instruction);
uint64 extract_stype_20_19_18_17_16(uint64 instruction); uint64 extract_stype_20_19_18_17_16(uint64 instruction);
@ -226,49 +228,24 @@ private:
uint64 extract_u_15_to_0(uint64 instruction); uint64 extract_u_15_to_0(uint64 instruction);
uint64 extract_u_17_to_0(uint64 instruction); uint64 extract_u_17_to_0(uint64 instruction);
uint64 extract_u_1_0(uint64 instruction); uint64 extract_u_1_0(uint64 instruction);
uint64 extr_uil0il1bs4Fmsb4(uint64 instruction); uint64 extract_u_3_2_1_0__s1(uint64 instruction);
uint64 extr_uil0il2bs3Fmsb4(uint64 instruction); uint64 extract_u_2_1_0__s2(uint64 instruction);
uint64 extr_uil0il2bs4Fmsb5(uint64 instruction); uint64 extract_u_3_2_1_0__s2(uint64 instruction);
uint64 extr_uil0il2bs5Fmsb6(uint64 instruction); uint64 extract_u_4_3_2_1_0__s2(uint64 instruction);
uint64 extr_uil0il2bs6Fmsb7(uint64 instruction); uint64 extract_u_5_4_3_2_1_0__s2(uint64 instruction);
uint64 extr_uil0il2bs7Fmsb8(uint64 instruction); uint64 extract_u_6_5_4_3_2_1_0__s2(uint64 instruction);
uint64 extr_uil0il32bs32Fmsb63(uint64 instruction); uint64 extract_u_31_to_0__s32(uint64 instruction);
uint64 extract_u_10(uint64 instruction); uint64 extract_u_10(uint64 instruction);
uint64 extract_u_17_16_15_14_13_12_11(uint64 instruction); uint64 extract_u_17_16_15_14_13_12_11(uint64 instruction);
uint64 extract_u_20_19_18_17_16_15_14_13(uint64 instruction); uint64 extract_u_20_19_18_17_16_15_14_13(uint64 instruction);
uint64 extr_uil1il1bs17Fmsb17(uint64 instruction); uint64 extract_u_17_to_1__s1(uint64 instruction);
uint64 extr_uil1il1bs2Fmsb2(uint64 instruction); uint64 extract_u_2_1__s1(uint64 instruction);
uint64 extr_uil2il2bs16Fmsb17(uint64 instruction); uint64 extract_u_17_to_2__s2(uint64 instruction);
uint64 extr_uil2il2bs19Fmsb20(uint64 instruction); uint64 extract_u_20_to_2__s2(uint64 instruction);
uint64 extr_uil3il3bs18Fmsb20(uint64 instruction); uint64 extract_u_20_to_3__s3(uint64 instruction);
uint64 extr_uil3il3bs1_il8il2bs1Fmsb3(uint64 instruction); uint64 extract_u_3_8__s2(uint64 instruction);
uint64 extr_uil3il3bs9Fmsb11(uint64 instruction); uint64 extract_u_11_10_9_8_7_6_5_4_3__s3(uint64 instruction);
uint64 extr_uil4il4bs4Fmsb7(uint64 instruction); uint64 extract_u_7_6_5_4__s4(uint64 instruction);
uint64 extr_xil0il0bs12Fmsb11(uint64 instruction);
uint64 extr_xil0il0bs3_il4il0bs1Fmsb2(uint64 instruction);
uint64 extr_xil10il0bs1Fmsb0(uint64 instruction);
uint64 extr_xil10il0bs1_il11il0bs5Fmsb4(uint64 instruction);
uint64 extr_xil10il0bs1_il14il0bs2Fmsb1(uint64 instruction);
uint64 extr_xil10il0bs4_il22il0bs4Fmsb3(uint64 instruction);
uint64 extr_xil10il0bs6Fmsb5(uint64 instruction);
uint64 extr_xil11il0bs1Fmsb0(uint64 instruction);
uint64 extr_xil11il0bs5Fmsb4(uint64 instruction);
uint64 extr_xil12il0bs1Fmsb0(uint64 instruction);
uint64 extr_xil14il0bs1_il15il0bs1Fmsb0(uint64 instruction);
uint64 extr_xil14il0bs2Fmsb1(uint64 instruction);
uint64 extr_xil15il0bs1Fmsb0(uint64 instruction);
uint64 extr_xil16il0bs10Fmsb9(uint64 instruction);
uint64 extr_xil16il0bs5Fmsb4(uint64 instruction);
uint64 extr_xil17il0bs1Fmsb0(uint64 instruction);
uint64 extr_xil17il0bs9Fmsb8(uint64 instruction);
uint64 extr_xil21il0bs5Fmsb4(uint64 instruction);
uint64 extr_xil24il0bs1Fmsb0(uint64 instruction);
uint64 extr_xil2il0bs1_il15il0bs1Fmsb0(uint64 instruction);
uint64 extr_xil6il0bs3Fmsb2(uint64 instruction);
uint64 extr_xil6il0bs3_il10il0bs1Fmsb2(uint64 instruction);
uint64 extr_xil9il0bs2Fmsb1(uint64 instruction);
uint64 extr_xil9il0bs3Fmsb2(uint64 instruction);
uint64 extr_xil9il0bs3_il16il0bs5Fmsb4(uint64 instruction);
bool ADDIU_32__cond(uint64 instruction); bool ADDIU_32__cond(uint64 instruction);
bool ADDIU_RS5__cond(uint64 instruction); bool ADDIU_RS5__cond(uint64 instruction);

View File

@ -99,9 +99,10 @@
* those few cases by hand. * those few cases by hand.
* *
* Note that x32 is fully detected with __x86_64__ + _ILP32, and that for * Note that x32 is fully detected with __x86_64__ + _ILP32, and that for
* Sparc we always force the use of sparcv9 in configure. * Sparc we always force the use of sparcv9 in configure. MIPS n32 (ILP32) &
* n64 (LP64) ABIs are both detected using __mips64.
*/ */
#if defined(__x86_64__) || defined(__sparc__) #if defined(__x86_64__) || defined(__sparc__) || defined(__mips64)
# define ATOMIC_REG_SIZE 8 # define ATOMIC_REG_SIZE 8
#else #else
# define ATOMIC_REG_SIZE sizeof(void *) # define ATOMIC_REG_SIZE sizeof(void *)

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,8 @@ CFLAGS = -Wall -mabi=32 -march=r5900 -static
TESTCASES = div1.tst TESTCASES = div1.tst
TESTCASES += divu1.tst TESTCASES += divu1.tst
TESTCASES += madd.tst
TESTCASES += maddu.tst
TESTCASES += mflohi1.tst TESTCASES += mflohi1.tst
TESTCASES += mtlohi1.tst TESTCASES += mtlohi1.tst
TESTCASES += mult.tst TESTCASES += mult.tst

View File

@ -0,0 +1,78 @@
/*
* Test R5900-specific three-operand MADD and MADD1.
*/
#include <stdio.h>
#include <inttypes.h>
#include <assert.h>
int64_t madd(int64_t a, int32_t rs, int32_t rt)
{
int32_t lo = a;
int32_t hi = a >> 32;
int32_t rd;
int64_t r;
__asm__ __volatile__ (
" mtlo %5\n"
" mthi %6\n"
" madd %0, %3, %4\n"
" mflo %1\n"
" mfhi %2\n"
: "=r" (rd), "=r" (lo), "=r" (hi)
: "r" (rs), "r" (rt), "r" (lo), "r" (hi));
r = ((int64_t)hi << 32) | (uint32_t)lo;
assert(a + (int64_t)rs * rt == r);
assert(rd == lo);
return r;
}
int64_t madd1(int64_t a, int32_t rs, int32_t rt)
{
int32_t lo = a;
int32_t hi = a >> 32;
int32_t rd;
int64_t r;
__asm__ __volatile__ (
" mtlo1 %5\n"
" mthi1 %6\n"
" madd1 %0, %3, %4\n"
" mflo1 %1\n"
" mfhi1 %2\n"
: "=r" (rd), "=r" (lo), "=r" (hi)
: "r" (rs), "r" (rt), "r" (lo), "r" (hi));
r = ((int64_t)hi << 32) | (uint32_t)lo;
assert(a + (int64_t)rs * rt == r);
assert(rd == lo);
return r;
}
static int64_t madd_variants(int64_t a, int32_t rs, int32_t rt)
{
int64_t rd = madd(a, rs, rt);
int64_t rd1 = madd1(a, rs, rt);
assert(rd == rd1);
return rd;
}
static void verify_madd(int64_t a, int32_t rs, int32_t rt, int64_t expected)
{
assert(madd_variants(a, rs, rt) == expected);
assert(madd_variants(a, -rs, rt) == a + a - expected);
assert(madd_variants(a, rs, -rt) == a + a - expected);
assert(madd_variants(a, -rs, -rt) == expected);
}
int main()
{
verify_madd(13, 17, 19, 336);
return 0;
}

View File

@ -0,0 +1,70 @@
/*
* Test R5900-specific three-operand MADDU and MADDU1.
*/
#include <stdio.h>
#include <inttypes.h>
#include <assert.h>
uint64_t maddu(uint64_t a, uint32_t rs, uint32_t rt)
{
uint32_t lo = a;
uint32_t hi = a >> 32;
uint32_t rd;
uint64_t r;
__asm__ __volatile__ (
" mtlo %5\n"
" mthi %6\n"
" maddu %0, %3, %4\n"
" mflo %1\n"
" mfhi %2\n"
: "=r" (rd), "=r" (lo), "=r" (hi)
: "r" (rs), "r" (rt), "r" (lo), "r" (hi));
r = ((uint64_t)hi << 32) | (uint32_t)lo;
assert(a + (uint64_t)rs * rt == r);
assert(rd == lo);
return r;
}
uint64_t maddu1(uint64_t a, uint32_t rs, uint32_t rt)
{
uint32_t lo = a;
uint32_t hi = a >> 32;
uint32_t rd;
uint64_t r;
__asm__ __volatile__ (
" mtlo1 %5\n"
" mthi1 %6\n"
" maddu1 %0, %3, %4\n"
" mflo1 %1\n"
" mfhi1 %2\n"
: "=r" (rd), "=r" (lo), "=r" (hi)
: "r" (rs), "r" (rt), "r" (lo), "r" (hi));
r = ((uint64_t)hi << 32) | (uint32_t)lo;
assert(a + (uint64_t)rs * rt == r);
assert(rd == lo);
return r;
}
static int64_t maddu_variants(int64_t a, int32_t rs, int32_t rt)
{
int64_t rd = maddu(a, rs, rt);
int64_t rd1 = maddu1(a, rs, rt);
assert(rd == rd1);
return rd;
}
int main()
{
assert(maddu_variants(13, 17, 19) == 336);
return 0;
}