qemu/tests/tcg/mips/mips32-dsp/addq_s_ph.c
<<
>>
Prefs
   1#include<stdio.h>
   2#include<assert.h>
   3
   4int main()
   5{
   6    int rd, rs, rt;
   7    int dsp;
   8    int result;
   9
  10    rs     = 0xFFFFFFFF;
  11    rt     = 0x10101010;
  12    result = 0x100F100F;
  13    __asm
  14        ("addq_s.ph   %0, %1, %2\n\t"
  15         : "=r"(rd)
  16         : "r"(rs), "r"(rt)
  17        );
  18    assert(result == rd);
  19
  20    rs     = 0x3712847D;
  21    rt     = 0x0031AF2D;
  22    result = 0x37438000;
  23    __asm
  24        ("addq_s.ph   %0, %1, %2\n\t"
  25         : "=r"(rd)
  26         : "r"(rs), "r"(rt)
  27        );
  28    assert(result == rd);
  29
  30    __asm
  31        ("rddsp %0\n\t"
  32         : "=r"(dsp)
  33        );
  34    assert(((dsp >> 20) & 0x01) == 1);
  35
  36    rs     = 0x7fff847D;
  37    rt     = 0x0031AF2D;
  38    result = 0x7fff8000;
  39    __asm
  40        ("addq_s.ph   %0, %1, %2\n\t"
  41         : "=r"(rd)
  42         : "r"(rs), "r"(rt)
  43        );
  44    assert(result == rd);
  45
  46    __asm
  47        ("rddsp %0\n\t"
  48         : "=r"(dsp)
  49        );
  50    assert(((dsp >> 20) & 0x01) == 1);
  51
  52    rs     = 0x8030847D;
  53    rt     = 0x8a00AF2D;
  54    result = 0x80008000;
  55    __asm
  56        ("addq_s.ph   %0, %1, %2\n\t"
  57         : "=r"(rd)
  58         : "r"(rs), "r"(rt)
  59        );
  60    assert(result == rd);
  61
  62    __asm
  63        ("rddsp %0\n\t"
  64         : "=r"(dsp)
  65        );
  66    assert(((dsp >> 20) & 0x01) == 1);
  67
  68    return 0;
  69}
  70