qemu/tests/tcg/mips/mips64-dsp/dmsub.c
<<
>>
Prefs
   1#include "io.h"
   2
   3int main(void)
   4{
   5    long long rt, rs;
   6    long long achi, acli;
   7    long long acho, aclo;
   8    long long resh, resl;
   9    achi = 0x1;
  10    acli = 0x8;
  11
  12    rs = 0x0000000100000001;
  13    rt = 0x0000000200000002;
  14
  15    resh = 0x1;
  16    resl = 0x4;
  17
  18    __asm
  19        ("mthi %2, $ac1 \t\n"
  20         "mtlo %3, $ac1 \t\n"
  21         "dmsub $ac1, %4, %5\t\n"
  22         "mfhi %0, $ac1 \t\n"
  23         "mflo %1, $ac1 \t\n"
  24         : "=r"(acho), "=r"(aclo)
  25         : "r"(achi), "r"(acli), "r"(rs), "r"(rt)
  26        );
  27    if ((acho != resh) || (aclo != resl)) {
  28        printf("1 dmsub error\n");
  29
  30        return -1;
  31    }
  32
  33    achi = 0xfffffffF;
  34    acli = 0xfffffffF;
  35
  36    rs = 0x8888999977776666;
  37    rt = 0x9999888877776666;
  38
  39    resh = 0xffffffffffffffff;
  40    resl = 0x789aae13;
  41
  42    __asm
  43        ("mthi %2, $ac1 \t\n"
  44         "mtlo %3, $ac1 \t\n"
  45         "dmsub $ac1, %4, %5\t\n"
  46         "mfhi %0, $ac1 \t\n"
  47         "mflo %1, $ac1 \t\n"
  48         : "=r"(acho), "=r"(aclo)
  49         : "r"(achi), "r"(acli), "r"(rs), "r"(rt)
  50        );
  51
  52    if ((acho != resh) || (aclo != resl)) {
  53        printf("2 dmsub error\n");
  54
  55        return -1;
  56    }
  57
  58    return 0;
  59}
  60