qemu/tests/tcg/mips/mips64-dsp/addq_ph.c
<<
>>
Prefs
   1#include "io.h"
   2
   3int main(void)
   4{
   5    long long rd, rs, rt;
   6    long long dsp;
   7    long long result;
   8
   9    rs     = 0xFFFFFFFF;
  10    rt     = 0x10101010;
  11    result = 0x100F100F;
  12    __asm
  13        ("addq.ph   %0, %1, %2\n\t"
  14         : "=r"(rd)
  15         : "r"(rs), "r"(rt)
  16        );
  17    if (rd != result) {
  18        printf("1 addq.ph wrong\n");
  19
  20        return -1;
  21    }
  22
  23    rs     = 0x3712847D;
  24    rt     = 0x0031AF2D;
  25    result = 0x374333AA;
  26    __asm
  27        ("addq.ph   %0, %1, %2\n\t"
  28         : "=r"(rd)
  29         : "r"(rs), "r"(rt)
  30        );
  31    if (rd != result) {
  32        printf("2 addq.ph wrong\n");
  33
  34        return -1;
  35    }
  36
  37    rs     = 0x7fff847D;
  38    rt     = 0x0031AF2D;
  39    result = 0xffffffff803033AA;
  40    __asm
  41        ("addq.ph   %0, %1, %2\n\t"
  42         : "=r"(rd)
  43         : "r"(rs), "r"(rt)
  44        );
  45
  46    __asm("rddsp %0\n\t"
  47          : "=r"(dsp)
  48         );
  49
  50    if (rd != result || (((dsp >> 20) & 0x01) != 1)) {
  51        printf("3 addq.ph wrong\n");
  52
  53        return -1;
  54    }
  55
  56    return 0;
  57}
  58