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