qemu/tests/tcg/mips/mips64-dsp/absq_s_pw.c
<<
>>
Prefs
   1#include "io.h"
   2
   3int main(void)
   4{
   5    long long rd, rt, result, dspcontrol;
   6    rd = 0;
   7    rt = 0x7F7F7F7F7F7F7F7F;
   8    result = 0x7F7F7F7F7F7F7F7F;
   9
  10
  11    __asm
  12        ("absq_s.pw %0, %1\n\t"
  13         : "=r"(rd)
  14         : "r"(rt)
  15        );
  16
  17    if (result != rd) {
  18        printf("absq_s.pw test 1 error\n");
  19
  20        return -1;
  21    }
  22
  23    rd = 0;
  24    __asm
  25        ("rddsp %0\n\t"
  26         : "=r"(rd)
  27        );
  28    rd >> 20;
  29    rd = rd & 0x1;
  30    if (rd != 0) {
  31        printf("absq_s.pw test 1 dspcontrol overflow flag error\n");
  32
  33        return -1;
  34    }
  35
  36    rd = 0;
  37    rt = 0x80000000FFFFFFFF;
  38    result = 0x7FFFFFFF00000001;
  39
  40    __asm
  41        ("absq_s.pw %0, %1\n\t"
  42         : "=r"(rd)
  43         : "r"(rt)
  44        );
  45    if (result != rd) {
  46        printf("absq_s.pw test 2 error\n");
  47
  48        return -1;
  49    }
  50
  51    rd = 0;
  52    __asm
  53        ("rddsp %0\n\t"
  54         : "=r"(rd)
  55        );
  56    rd = rd >> 20;
  57    rd = rd & 0x1;
  58    if (rd != 1) {
  59        printf("absq_s.pw test 2 dspcontrol overflow flag error\n");
  60
  61        return -1;
  62    }
  63
  64    return 0;
  65}
  66
  67