2 * Test R5900-specific three-operand MADDU and MADDU1.
9 uint64_t maddu(uint64_t a
, uint32_t rs
, uint32_t rt
)
12 uint32_t hi
= a
>> 32;
16 __asm__
__volatile__ (
22 : "=r" (rd
), "=r" (lo
), "=r" (hi
)
23 : "r" (rs
), "r" (rt
), "r" (lo
), "r" (hi
));
24 r
= ((uint64_t)hi
<< 32) | (uint32_t)lo
;
26 assert(a
+ (uint64_t)rs
* rt
== r
);
32 uint64_t maddu1(uint64_t a
, uint32_t rs
, uint32_t rt
)
35 uint32_t hi
= a
>> 32;
39 __asm__
__volatile__ (
42 " maddu1 %0, %3, %4\n"
45 : "=r" (rd
), "=r" (lo
), "=r" (hi
)
46 : "r" (rs
), "r" (rt
), "r" (lo
), "r" (hi
));
47 r
= ((uint64_t)hi
<< 32) | (uint32_t)lo
;
49 assert(a
+ (uint64_t)rs
* rt
== r
);
55 static int64_t maddu_variants(int64_t a
, int32_t rs
, int32_t rt
)
57 int64_t rd
= maddu(a
, rs
, rt
);
58 int64_t rd1
= maddu1(a
, rs
, rt
);
67 assert(maddu_variants(13, 17, 19) == 336);