qemu/tests/tcg/mips/mips64-dsp/maq_sa_w_phl.c
<<
>>
Prefs
   1#include "io.h"
   2
   3int main(void)
   4{
   5    long long rt, rs;
   6    long long achi, acli;
   7    long long dsp;
   8    long long acho, aclo;
   9    long long resulth, resultl;
  10    long long resdsp;
  11
  12    achi = 0x05;
  13    acli = 0xB4CB;
  14    rs = 0xFF060000;
  15    rt = 0xCB000000;
  16    resulth = 0xffffffffffffffff;
  17    resultl = 0xffffffff947438cb;
  18
  19    __asm
  20        ("mthi %2, $ac1\n\t"
  21         "mtlo %3, $ac1\n\t"
  22         "maq_sa.w.phl $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    if ((resulth != acho) || (resultl != aclo)) {
  29        printf("1 maq_sa.w.phl error\n");
  30
  31        return -1;
  32    }
  33
  34    achi = 0x06;
  35    acli = 0xB4CB;
  36    rs  = 0x80000000;
  37    rt  = 0x80000000;
  38    resulth = 0x00;
  39    resultl = 0x7fffffff;
  40    resdsp = 0x01;
  41
  42    __asm
  43        ("mthi %3, $ac1\n\t"
  44         "mtlo %4, $ac1\n\t"
  45         "maq_sa.w.phl $ac1, %5, %6\n\t"
  46         "mfhi %0, $ac1\n\t"
  47         "mflo %1, $ac1\n\t"
  48         "rddsp %2\n\t"
  49         : "=r"(acho), "=r"(aclo), "=r"(dsp)
  50         : "r"(achi), "r"(acli), "r"(rs), "r"(rt)
  51        );
  52    if ((resulth != acho) || (resultl != aclo) ||
  53        (((dsp >> 17) & 0x01) != 0x01)) {
  54        printf("2 maq_sa.w.phl error\n");
  55
  56        return -1;
  57    }
  58
  59    return 0;
  60}
  61