qemu/tests/tcg/mips/mips64-dsp/dpaq_sa_l_w.c
<<
>>
Prefs
   1#include "io.h"
   2
   3int main(void)
   4{
   5    long long rs, rt, dsp;
   6    long long ach = 0, acl = 0;
   7    long long resulth, resultl, resultdsp;
   8
   9    rs        = 0x80000000;
  10    rt        = 0x80000000;
  11    resulth   = 0x7FFFFFFF;
  12    resultl   = 0xffffffffFFFFFFFF;
  13    resultdsp = 0x01;
  14    __asm
  15        ("mthi        %0, $ac1\n\t"
  16         "mtlo        %0, $ac1\n\t"
  17         "dpaq_sa.l.w $ac1, %3, %4\n\t"
  18         "mfhi        %0,   $ac1\n\t"
  19         "mflo        %1,   $ac1\n\t"
  20         "rddsp       %2\n\t"
  21         : "+r"(ach), "+r"(acl), "=r"(dsp)
  22         : "r"(rs), "r"(rt)
  23        );
  24    dsp = (dsp >> 17) & 0x01;
  25    if ((dsp != resultdsp) || (ach != resulth) || (acl != resultl)) {
  26        printf("dpaq_sa.l.w error\n");
  27
  28        return -1;
  29    }
  30
  31    ach = 0x12;
  32    acl = 0x48;
  33    rs  = 0x80000000;
  34    rt  = 0x80000000;
  35
  36    resulth   = 0x7FFFFFFF;
  37    resultl   = 0xffffffffFFFFFFFF;
  38    resultdsp = 0x01;
  39    __asm
  40        ("mthi        %0, $ac1\n\t"
  41         "mtlo        %0, $ac1\n\t"
  42         "dpaq_sa.l.w $ac1, %3, %4\n\t"
  43         "mfhi        %0,   $ac1\n\t"
  44         "mflo        %1,   $ac1\n\t"
  45         "rddsp       %2\n\t"
  46         : "+r"(ach), "+r"(acl), "=r"(dsp)
  47         : "r"(rs), "r"(rt)
  48        );
  49    dsp = (dsp >> 17) & 0x01;
  50    if ((dsp != resultdsp) || (ach != resulth) || (acl != resultl)) {
  51        printf("dpaq_sa.l.w error\n");
  52
  53        return -1;
  54    }
  55
  56    ach = 0x741532A0;
  57    acl = 0xfceabb08;
  58    rs  = 0x80000000;
  59    rt  = 0x80000000;
  60
  61    resulth   = 0x7fffffff;
  62    resultl   = 0xffffffffffffffff;
  63    resultdsp = 0x01;
  64    __asm
  65        ("mthi        %0, $ac1\n\t"
  66         "mtlo        %0, $ac1\n\t"
  67         "dpaq_sa.l.w $ac1, %3, %4\n\t"
  68         "mfhi        %0,   $ac1\n\t"
  69         "mflo        %1,   $ac1\n\t"
  70         "rddsp       %2\n\t"
  71         : "+r"(ach), "+r"(acl), "=r"(dsp)
  72         : "r"(rs), "r"(rt)
  73        );
  74    dsp = (dsp >> 17) & 0x01;
  75    if ((dsp != resultdsp) || (ach != resulth) || (acl != resultl)) {
  76        printf("dpaq_sa.l.w error\n");
  77
  78        return -1;
  79    }
  80
  81    return 0;
  82}
  83