qemu/tests/tcg/mips/mips64-dsp/dextpv.c
<<
>>
Prefs
   1#include "io.h"
   2
   3int main(void)
   4{
   5    long long rt, rs, dsp;
   6    long long achi, acli;
   7    long long res, resdsp;
   8    int rsdsp;
   9
  10    rsdsp = 0xabcd1234;
  11    rs = 0x7;
  12
  13    achi = 0x12345678;
  14    acli = 0x87654321;
  15    res = 0xff;
  16    resdsp = 0x0;
  17
  18    __asm
  19        ("mthi %2, $ac1\n\t"
  20         "mtlo %3, $ac1\n\t"
  21         "wrdsp %4, 0x1\n\t"
  22         "wrdsp %4\n\t"
  23         "dextpv %0, $ac1, %5\n\t"
  24         "rddsp %1\n\t"
  25         : "=r"(rt), "=r"(dsp)
  26         : "r"(achi), "r"(acli), "r"(rsdsp), "r"(rs)
  27        );
  28    dsp = (dsp >> 14) & 0x1;
  29    if ((dsp != resdsp) || (rt != res)) {
  30        printf("dextpv error\n");
  31        return -1;
  32    }
  33
  34    rsdsp = 0xabcd1200;
  35    rs = 0x7;
  36
  37    achi = 0x12345678;
  38    acli = 0x87654321;
  39    resdsp = 0x1;
  40
  41    __asm
  42        ("mthi %2, $ac1\n\t"
  43         "mtlo %3, $ac1\n\t"
  44         "wrdsp %4, 0x1\n\t"
  45         "wrdsp %4\n\t"
  46         "dextpv %0, $ac1, %5\n\t"
  47         "rddsp %1\n\t"
  48         : "=r"(rt), "=r"(dsp)
  49         : "r"(achi), "r"(acli), "r"(rsdsp), "r"(rs)
  50        );
  51    dsp = (dsp >> 14) & 0x1;
  52    if (dsp != resdsp) {
  53        printf("dextpv error\n");
  54        return -1;
  55    }
  56
  57    return 0;
  58}
  59