Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / tcg / mips / user / isa / r5900 / test_r5900_mflohi1.c
blobeed3683dc5d43735b23cba1a1a2483f9584fd141
1 /*
2 * Test R5900-specific MFLO1 and MFHI1.
3 */
5 #include <stdio.h>
6 #include <inttypes.h>
7 #include <assert.h>
9 int main()
11 int32_t rs = 12207031, rt = 305175781;
12 int32_t rs1 = 32452867, rt1 = 49979687;
13 int64_t lo, hi, lo1, hi1;
14 int64_t r, r1;
16 /* Test both LO/HI and LO1/HI1 to verify separation. */
17 __asm__ __volatile__ (
18 " mult $0, %4, %5\n"
19 " mult1 $0, %6, %7\n"
20 " mflo %0\n"
21 " mfhi %1\n"
22 " mflo1 %2\n"
23 " mfhi1 %3\n"
24 : "=r" (lo), "=r" (hi),
25 "=r" (lo1), "=r" (hi1)
26 : "r" (rs), "r" (rt),
27 "r" (rs1), "r" (rt1));
28 r = ((int64_t)hi << 32) | (uint32_t)lo;
29 r1 = ((int64_t)hi1 << 32) | (uint32_t)lo1;
31 assert(r == 3725290219116211);
32 assert(r1 == 1621984134912629);
34 return 0;