qemu/tests/tcg/mips/mips32-dspr2/mul_s_ph.c
<<
>>
Prefs
   1#include<stdio.h>
   2#include<assert.h>
   3
   4int main()
   5{
   6    int rd, rs, rt, dsp;
   7    int result, resultdsp;
   8
   9    rs = 0x03FB1234;
  10    rt = 0x0BCC4321;
  11    result = 0x7fff7FFF;
  12    resultdsp = 1;
  13
  14    __asm
  15        ("mul_s.ph %0, %2, %3\n\t"
  16         "rddsp %1\n\t"
  17         : "=r"(rd), "=r"(dsp)
  18         : "r"(rs), "r"(rt)
  19        );
  20    dsp = (dsp >> 21) & 0x01;
  21    assert(rd  == result);
  22    assert(dsp == resultdsp);
  23
  24    rs = 0x7fffff00;
  25    rt = 0xff007fff;
  26    result = 0x80008000;
  27    resultdsp = 1;
  28
  29    __asm
  30        ("mul_s.ph %0, %2, %3\n\t"
  31         "rddsp %1\n\t"
  32         : "=r"(rd), "=r"(dsp)
  33         : "r"(rs), "r"(rt)
  34        );
  35    dsp = (dsp >> 21) & 0x01;
  36    assert(rd  == result);
  37    assert(dsp == resultdsp);
  38
  39    dsp = 0;
  40    __asm
  41        ("wrdsp %0\n\t"
  42         :
  43         : "r"(dsp)
  44        );
  45
  46    rs = 0x00320001;
  47    rt = 0x00210002;
  48    result = 0x06720002;
  49    resultdsp = 0;
  50
  51    __asm
  52        ("mul_s.ph %0, %2, %3\n\t"
  53         "rddsp %1\n\t"
  54         : "=r"(rd), "=r"(dsp)
  55         : "r"(rs), "r"(rt)
  56        );
  57    dsp = (dsp >> 21) & 0x01;
  58    assert(rd  == result);
  59    assert(dsp == resultdsp);
  60
  61    return 0;
  62}
  63