mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:56:38 +00:00
tests/tcg/mips: cover Octeon QMAC instructions
Add smoke coverage for Octeon QMAC and QMACS fixed-point accumulator instruction paths. The coverage exercises normal accumulation, saturating accumulation, and the sticky saturation flag. Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260608-mips-octeon-missing-insns-v2-v16-21-daef7a0d8b04@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
This commit is contained in:
committed by
Philippe Mathieu-Daudé
parent
c2fd17ec64
commit
b6726871b9
@@ -129,6 +129,43 @@ static uint64_t octeon_vmm0(uint64_t mpl0, uint64_t p0,
|
||||
return rd;
|
||||
}
|
||||
|
||||
static uint64_t octeon_qmac_lo(uint64_t rs, uint64_t rt, uint64_t lo)
|
||||
{
|
||||
uint64_t rd;
|
||||
|
||||
asm volatile(
|
||||
"move $8, %[rs]\n\t"
|
||||
"move $9, %[rt]\n\t"
|
||||
"mtlo %[lo]\n\t"
|
||||
"mthi $0\n\t"
|
||||
".word 0x710904d2\n\t" /* qmac.03 $8, $9 */
|
||||
"mflo %[rd]\n\t"
|
||||
: [rd] "=r" (rd)
|
||||
: [rs] "r" (rs), [rt] "r" (rt), [lo] "r" (lo)
|
||||
: "$8", "$9");
|
||||
|
||||
return rd;
|
||||
}
|
||||
|
||||
static uint64_t octeon_qmacs_state(uint64_t rs, uint64_t rt, uint64_t lo)
|
||||
{
|
||||
uint64_t hi, rd;
|
||||
|
||||
asm volatile(
|
||||
"move $8, %[rs]\n\t"
|
||||
"move $9, %[rt]\n\t"
|
||||
"mtlo %[lo]\n\t"
|
||||
"mthi $0\n\t"
|
||||
".word 0x71090012\n\t" /* qmacs.00 $8, $9 */
|
||||
"mfhi %[hi]\n\t"
|
||||
"mflo %[rd]\n\t"
|
||||
: [hi] "=r" (hi), [rd] "=r" (rd)
|
||||
: [rs] "r" (rs), [rt] "r" (rt), [lo] "r" (lo)
|
||||
: "$8", "$9");
|
||||
|
||||
return ((hi & 1) << 32) | (rd & 0xffffffff);
|
||||
}
|
||||
|
||||
static uint64_t octeon_vmm0_zeroes_mpl1(void)
|
||||
{
|
||||
uint64_t rd;
|
||||
@@ -355,6 +392,9 @@ int main(void)
|
||||
assert(octeon_seq(0xabc, 0xdef) == 0);
|
||||
assert(octeon_sne(0xabc, 0xabc) == 0);
|
||||
assert(octeon_sne(0xabc, 0xdef) == 1);
|
||||
assert(octeon_qmac_lo(0x0003000000000000ULL, 2, 1) == 13);
|
||||
assert(octeon_qmacs_state(1, 1, 0x7ffffffe) == 0x17fffffffULL);
|
||||
assert(octeon_qmacs_state(0x8000, 0x8000, 0) == 0x17fffffffULL);
|
||||
assert(octeon_vmulu(5, 7, 11) == 46);
|
||||
assert(octeon_vmm0(5, 13, 7, 11) == 59);
|
||||
assert(octeon_vmm0_zeroes_mpl1() == 0);
|
||||
|
||||
Reference in New Issue
Block a user