2 * Test R5900-specific three-operand MULTU and MULTU1.
9 static uint64_t multu(uint32_t rs
, uint32_t rt
)
14 __asm__
__volatile__ (
18 : "=r" (rd
), "=r" (lo
), "=r" (hi
)
19 : "r" (rs
), "r" (rt
));
20 r
= ((uint64_t)hi
<< 32) | (uint32_t)lo
;
22 assert((uint64_t)rs
* rt
== r
);
28 static uint64_t multu1(uint32_t rs
, uint32_t rt
)
33 __asm__
__volatile__ (
34 " multu1 %0, %3, %4\n"
37 : "=r" (rd
), "=r" (lo
), "=r" (hi
)
38 : "r" (rs
), "r" (rt
));
39 r
= ((uint64_t)hi
<< 32) | (uint32_t)lo
;
41 assert((uint64_t)rs
* rt
== r
);
47 static uint64_t multu_variants(uint32_t rs
, uint32_t rt
)
49 uint64_t rd
= multu(rs
, rt
);
50 uint64_t rd1
= multu1(rs
, rt
);
59 assert(multu_variants(17, 19) == 323);
60 assert(multu_variants(77773, 99991) == 7776600043);
61 assert(multu_variants(12207031, 305175781) == 3725290219116211);
63 assert(multu_variants(0x80000000U
, 0x7FFFFFFF) == 0x3FFFFFFF80000000);
64 assert(multu_variants(0x80000000U
, 0x80000000U
) == 0x4000000000000000);
65 assert(multu_variants(0xFFFFFFFFU
, 0xFFFFFFFFU
) == 0xFFFFFFFE00000001U
);