qemu/tests/tcg/mips/mips32-dsp/shll_s_w.c
<<
>>
Prefs
   1#include<stdio.h>
   2#include<assert.h>
   3
   4int main()
   5{
   6    int rd, rt, dsp;
   7    int result, resultdsp;
   8
   9    rt        = 0x82345678;
  10    result    = 0x82345678;
  11    resultdsp = 0x00;
  12
  13    __asm
  14        ("shll_s.w %0, %2, 0x0\n\t"
  15         "rddsp %1\n\t"
  16         : "=r"(rd), "=r"(dsp)
  17         : "r"(rt)
  18        );
  19    dsp = (dsp >> 22) & 0x01;
  20    assert(dsp == resultdsp);
  21    assert(rd  == result);
  22
  23    rt        = 0x82345678;
  24    result    = 0x80000000;
  25    resultdsp = 0x01;
  26
  27    __asm
  28        ("shll_s.w %0, %2, 0x0B\n\t"
  29         "rddsp %1\n\t"
  30         : "=r"(rd), "=r"(dsp)
  31         : "r"(rt)
  32        );
  33    dsp = (dsp >> 22) & 0x01;
  34    assert(dsp == resultdsp);
  35    assert(rd  == result);
  36
  37    rt        = 0x12345678;
  38    result    = 0x7FFFFFFF;
  39    resultdsp = 0x01;
  40
  41    __asm
  42        ("shll_s.w %0, %2, 0x0B\n\t"
  43         "rddsp %1\n\t"
  44         : "=r"(rd), "=r"(dsp)
  45         : "r"(rt)
  46        );
  47    dsp = (dsp >> 22) & 0x01;
  48    assert(dsp == resultdsp);
  49    assert(rd  == result);
  50
  51    return 0;
  52}
  53