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