qemu/tests/tcg/mips/mips64-dspr2/mul_s_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 = 0x7fff7FFF;
  11    resultdsp = 1;
  12
  13    __asm
  14        ("mul_s.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("1 mul_s.ph error\n");
  22        return -1;
  23    }
  24
  25    rs = 0x7fffff00;
  26    rt = 0xff007fff;
  27    result = 0xffffffff80008000;
  28    resultdsp = 1;
  29
  30    __asm
  31        ("mul_s.ph %0, %2, %3\n\t"
  32         "rddsp %1\n\t"
  33         : "=r"(rd), "=r"(dsp)
  34         : "r"(rs), "r"(rt)
  35        );
  36    dsp = (dsp >> 21) & 0x01;
  37    if (rd != result || dsp != resultdsp) {
  38        printf("2 mul_s.ph error\n");
  39        return -1;
  40    }
  41
  42    dsp = 0;
  43    __asm
  44        ("wrdsp %0\n\t"
  45         :
  46         : "r"(dsp)
  47        );
  48
  49    rs = 0x00320001;
  50    rt = 0x00210002;
  51    result = 0x06720002;
  52    resultdsp = 0;
  53
  54    __asm
  55        ("mul_s.ph %0, %2, %3\n\t"
  56         "rddsp %1\n\t"
  57         : "=r"(rd), "=r"(dsp)
  58         : "r"(rs), "r"(rt)
  59        );
  60    dsp = (dsp >> 21) & 0x01;
  61    if (rd != result || dsp != resultdsp) {
  62        printf("3 mul_s.ph error\n");
  63        return -1;
  64    }
  65
  66    return 0;
  67}
  68