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