qemu/tests/tcg/mips/mips64-dsp/addq_pw.c
<<
>>
Prefs
   1#include "io.h"
   2
   3int main(void)
   4{
   5    long long rd, rs, rt, result, dspreg, dspresult;
   6
   7    rs = 0x123456787FFFFFFF;
   8    rt = 0x1111111100000101;
   9    result = 0x2345678980000100;
  10    dspresult = 0x1;
  11
  12    __asm
  13        ("addq.pw %0, %2, %3\n\t"
  14         "rddsp %1\n\t"
  15         : "=r"(rd), "=r"(dspreg)
  16         : "r"(rs), "r"(rt)
  17        );
  18
  19    dspreg = ((dspreg >> 20) & 0x01);
  20    if ((rd != result) || (dspreg != dspresult)) {
  21        printf("addq.pw error\n");
  22
  23        return -1;
  24    }
  25
  26    rs = 0x1234567880FFFFFF;
  27    rt = 0x1111111180000001;
  28    result = 0x2345678901000000;
  29    dspresult = 0x1;
  30
  31    __asm
  32        ("addq.pw %0, %2, %3\n\t"
  33         "rddsp %1\n\t"
  34         : "=r"(rd), "=r"(dspreg)
  35         : "r"(rs), "r"(rt)
  36        );
  37
  38    dspreg = ((dspreg >> 20) & 0x01);
  39    if ((rd != result) || (dspreg != dspresult)) {
  40        printf("addq.pw error\n");
  41
  42        return -1;
  43    }
  44
  45    return 0;
  46}
  47