1 /*
2  * Test R5900-specific MTLO1 and MTHI1.
3  */
4 
5 #include <stdio.h>
6 #include <inttypes.h>
7 #include <assert.h>
8 
9 int main()
10 {
11     int32_t tlo  = 12207031, thi  = 305175781;
12     int32_t tlo1 = 32452867, thi1 = 49979687;
13     int32_t flo, fhi, flo1, fhi1;
14 
15     /* Test both LO/HI and LO1/HI1 to verify separation. */
16     __asm__ __volatile__ (
17             "    mtlo  %4\n"
18             "    mthi  %5\n"
19             "    mtlo1 %6\n"
20             "    mthi1 %7\n"
21             "    move  %0, $0\n"
22             "    move  %1, $0\n"
23             "    move  %2, $0\n"
24             "    move  %3, $0\n"
25             "    mflo  %0\n"
26             "    mfhi  %1\n"
27             "    mflo1 %2\n"
28             "    mfhi1 %3\n"
29             : "=r" (flo),  "=r" (fhi),
30               "=r" (flo1), "=r" (fhi1)
31             : "r" (tlo),  "r" (thi),
32               "r" (tlo1), "r" (thi1));
33 
34     assert(flo  == 12207031);
35     assert(fhi  == 305175781);
36     assert(flo1 == 32452867);
37     assert(fhi1 == 49979687);
38 
39     return 0;
40 }
41