qemu/tests/tcg/mips/mips64-dsp/extrv_rs_w.c
<<
>>
Prefs
   1#include "io.h"
   2
   3int main(void)
   4{
   5    long long rt, rs, ach, acl, dsp;
   6    long long result;
   7
   8    ach = 0x05;
   9    acl = 0xB4CB;
  10    dsp = 0x07;
  11    rs  = 0x03;
  12    result = 0x7FFFFFFF;
  13
  14    __asm
  15        ("wrdsp %1, 0x01\n\t"
  16         "mthi %3, $ac1\n\t"
  17         "mtlo %4, $ac1\n\t"
  18         "extrv_rs.w %0, $ac1, %2\n\t"
  19         "rddsp %1\n\t"
  20         : "=r"(rt), "+r"(dsp)
  21         : "r"(rs), "r"(ach), "r"(acl)
  22        );
  23    dsp = (dsp >> 23) & 0x01;
  24    if ((dsp != 1) || (result != rt)) {
  25        printf("1 extrv_rs.w wrong\n");
  26
  27        return -1;
  28    }
  29
  30    /* Clear dspcontrol */
  31    dsp = 0;
  32    __asm
  33        ("wrdsp %0\n\t"
  34         :
  35         : "r"(dsp)
  36        );
  37
  38    rs = 4;
  39    ach = 0x01;
  40    acl = 0xB4CB;
  41    result = 0x10000B4D;
  42    __asm
  43        ("wrdsp %1, 0x01\n\t"
  44         "mthi %3, $ac1\n\t"
  45         "mtlo %4, $ac1\n\t"
  46         "extrv_rs.w %0, $ac1, %2\n\t"
  47         "rddsp %1\n\t"
  48         : "=r"(rt), "+r"(dsp)
  49         : "r"(rs), "r"(ach), "r"(acl)
  50        );
  51    dsp = (dsp >> 23) & 0x01;
  52    if ((dsp != 0) || (result != rt)) {
  53        printf("2 extrv_rs.w wrong\n");
  54
  55        return -1;
  56    }
  57
  58    return 0;
  59}
  60