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