qemu/tests/tcg/mips/user/isa/r5900/test_r5900_mflohi1.c
<<
>>
Prefs
   1/*
   2 * Test R5900-specific MFLO1 and MFHI1.
   3 */
   4
   5#include <stdio.h>
   6#include <inttypes.h>
   7#include <assert.h>
   8
   9int main()
  10{
  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;
  15
  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;
  30
  31    assert(r  == 3725290219116211);
  32    assert(r1 == 1621984134912629);
  33
  34    return 0;
  35}
  36