qemu/tests/tcg/mips/mips64-dspr2/mulq_rs_w.c
<<
>>
Prefs
   1#include"io.h"
   2
   3int main(void)
   4{
   5    long long rd, rs, rt, dsp;
   6    long long result, resultdsp;
   7
   8    rs = 0x80001234;
   9    rt = 0x80004321;
  10    result = 0xFFFFFFFF80005555;
  11
  12    __asm
  13        ("mulq_rs.w %0, %1, %2\n\t"
  14         : "=r"(rd)
  15         : "r"(rs), "r"(rt)
  16        );
  17    if (rd != result) {
  18        printf("mulq_rs.w error!\n");
  19        return -1;
  20    }
  21
  22    rs = 0x80000000;
  23    rt = 0x80000000;
  24    result = 0x7FFFFFFF;
  25    resultdsp = 1;
  26
  27    __asm
  28        ("mulq_rs.w %0, %2, %3\n\t"
  29         "rddsp %1\n\t"
  30         : "=r"(rd), "=r"(dsp)
  31         : "r"(rs), "r"(rt)
  32        );
  33    dsp = (dsp >> 21) & 0x01;
  34    if (rd != result || dsp != resultdsp) {
  35        printf("mulq_rs.w error\n");
  36        return -1;
  37    }
  38
  39    return 0;
  40}
  41