qemu/tests/tcg/mips/mips64-dspr2/absq_s_qb.c
<<
>>
Prefs
   1#include "io.h"
   2int main()
   3{
   4    long long input, result, dsp;
   5    long long hope;
   6
   7    input = 0x701BA35E;
   8    hope  = 0x701B5D5E;
   9
  10    __asm
  11        ("absq_s.qb %0, %1\n\t"
  12         : "=r"(result)
  13         : "r"(input)
  14        );
  15    if (result != hope) {
  16        printf("absq_s.qb error\n");
  17        return -1;
  18    }
  19
  20    input = 0x801BA35E;
  21    hope  = 0x7F1B5D5E;
  22
  23    __asm
  24        ("absq_s.qb %0, %2\n\t"
  25         "rddsp %1\n\t"
  26         : "=r"(result), "=r"(dsp)
  27         : "r"(input)
  28        );
  29    dsp = dsp >> 20;
  30    dsp &= 0x01;
  31    if (result != hope) {
  32        printf("absq_s.qb error\n");
  33        return -1;
  34    }
  35
  36    if (dsp != 1) {
  37        printf("absq_s.qb error\n");
  38        return -1;
  39    }
  40
  41    return 0;
  42}
  43