qemu/tests/tcg/mips/mips64-dspr2/dpaqx_sa_w_ph.c
<<
>>
Prefs
   1#include "io.h"
   2
   3int main()
   4{
   5    long long rs, rt, dsp;
   6    long long ach = 5, acl = 5;
   7    long long resulth, resultl, resultdsp;
   8
   9    rs     = 0x00FF00FF;
  10    rt     = 0x00010002;
  11    resulth = 0x00;
  12    resultl = 0x7FFFFFFF;
  13    resultdsp = 0x01;
  14    __asm
  15        ("wrdsp %2\n\t"
  16         "mthi  %0, $ac1\n\t"
  17         "mtlo  %1, $ac1\n\t"
  18         "dpaqx_sa.w.ph $ac1, %3, %4\n\t"
  19         "mfhi  %0, $ac1\n\t"
  20         "mflo  %1, $ac1\n\t"
  21         "rddsp %2\n\t"
  22         : "+r"(ach), "+r"(acl), "+r"(dsp)
  23         : "r"(rs), "r"(rt)
  24        );
  25    if ((dsp >> (16 + 1) != resultdsp) || (ach != resulth) ||
  26        (acl != resultl)) {
  27        printf("dpaqx_sa.w.ph errror\n");
  28    }
  29
  30    ach = 9;
  31    acl = 0xb;
  32    rs     = 0x800000FF;
  33    rt     = 0x00018000;
  34    resulth = 0x00;
  35    resultl = 0x7fffffff;
  36    resultdsp = 0x01;
  37    __asm
  38        ("wrdsp %2\n\t"
  39         "mthi  %0, $ac1\n\t"
  40         "mtlo  %1, $ac1\n\t"
  41         "dpaqx_sa.w.ph $ac1, %3, %4\n\t"
  42         "mfhi  %0, $ac1\n\t"
  43         "mflo  %1, $ac1\n\t"
  44         "rddsp %2\n\t"
  45         : "+r"(ach), "+r"(acl), "+r"(dsp)
  46         : "r"(rs), "r"(rt)
  47        );
  48    if ((dsp >> (16 + 1) != resultdsp) || (ach != resulth) ||
  49        (acl != resultl)) {
  50        printf("dpaqx_sa.w.ph errror\n");
  51    }
  52
  53    return 0;
  54}
  55