qemu/tests/tcg/mips/mips64-dsp/maq_s_w_qhrr.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 acho, aclo;
   8    long long resulth, resultl;
   9
  10    achi = 0x05;
  11    acli = 0x05;
  12
  13    rs  = 0x1234888812341234;
  14    rt  = 0x9876888898769876;
  15
  16    resulth = 0x05;
  17    resultl = 0x15ae87f5;
  18
  19    __asm
  20        ("mthi %2, $ac1\n\t"
  21         "mtlo %3, $ac1\n\t"
  22         "maq_s.w.qhrr $ac1, %4, %5\n\t"
  23         "mfhi %0, $ac1\n\t"
  24         "mflo %1, $ac1\n\t"
  25         : "=r"(acho), "=r"(aclo)
  26         : "r"(achi), "r"(acli), "r"(rs), "r"(rt)
  27        );
  28
  29    if ((resulth != acho) || (resultl != aclo)) {
  30        printf("1 maq_s.w.qhrr wrong\n");
  31
  32        return -1;
  33    }
  34
  35
  36    achi = 0x04;
  37    acli = 0x06;
  38    rs  = 0x8000888899998000;
  39    rt  = 0x8000888899998000;
  40
  41    resulth = 0x04;
  42    resultl = 0xffffffff80000005;
  43
  44    __asm
  45        ("mthi %3, $ac1\n\t"
  46         "mtlo %4, $ac1\n\t"
  47         "maq_s.w.qhrr $ac1, %5, %6\n\t"
  48         "mfhi %0, $ac1\n\t"
  49         "mflo %1, $ac1\n\t"
  50         "rddsp %2\n\t"
  51         : "=r"(acho), "=r"(aclo), "=r"(dsp)
  52         : "r"(achi), "r"(acli), "r"(rs), "r"(rt)
  53        );
  54
  55    dsp = (dsp >> 17) & 0x1;
  56    if ((dsp != 0x1) || (resulth != acho) || (resultl != aclo)) {
  57        printf("2 maq_s.w.qhrr wrong\n");
  58
  59        return -1;
  60    }
  61
  62    return 0;
  63}
  64