qemu/tests/tcg/mips/mips64-dspr2/addu_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     = 0x00FF00FF;
  10    rt     = 0x00010001;
  11    result = 0x01000100;
  12    __asm
  13        ("addu.ph %0, %1, %2\n\t"
  14         : "=r"(rd)
  15         : "r"(rs), "r"(rt)
  16        );
  17    if (rd != result) {
  18        printf("1 addu.ph error\n");
  19        return -1;
  20    }
  21
  22    rs     = 0xFFFF1111;
  23    rt     = 0x00020001;
  24    result = 0x00011112;
  25    __asm
  26        ("addu.ph %0, %2, %3\n\t"
  27         "rddsp %1\n\t"
  28         : "=r"(rd), "=r"(dsp)
  29         : "r"(rs), "r"(rt)
  30        );
  31    if ((rd != result) || (((dsp >> 20) & 0x01) != 1)) {
  32        printf("2 addu.ph error\n");
  33        return -1;
  34    }
  35
  36    return 0;
  37}
  38