qemu/tests/tcg/mips/mips64-dspr2/mul_ph.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 = 0x03FB1234;
   9    rt = 0x0BCC4321;
  10    result = 0xFFFFFFFFF504F4B4;
  11    resultdsp = 1;
  12
  13    __asm
  14        ("mul.ph %0, %2, %3\n\t"
  15         "rddsp %1\n\t"
  16         : "=r"(rd), "=r"(dsp)
  17         : "r"(rs), "r"(rt)
  18        );
  19    dsp = (dsp >> 21) & 0x01;
  20    if (rd  != result || dsp != resultdsp) {
  21        printf("mul.ph wrong\n");
  22        return -1;
  23    }
  24
  25    dsp = 0;
  26    __asm
  27        ("wrdsp %0\n\t"
  28         :
  29         : "r"(dsp)
  30        );
  31
  32    rs = 0x00210010;
  33    rt = 0x00110005;
  34    result = 0x2310050;
  35    resultdsp = 0;
  36
  37    __asm
  38        ("mul.ph %0, %2, %3\n\t"
  39         "rddsp %1\n\t"
  40         : "=r"(rd), "=r"(dsp)
  41         : "r"(rs), "r"(rt)
  42        );
  43    dsp = (dsp >> 21) & 0x01;
  44    if (rd  != result || dsp != resultdsp) {
  45        printf("mul.ph wrong\n");
  46        return -1;
  47    }
  48
  49    return 0;
  50}
  51