qemu/tests/tcg/mips/user/ase/dsp/test_dsp_r2_absq_s_qb.c
<<
>>
Prefs
   1#include<stdio.h>
   2#include<assert.h>
   3
   4int main()
   5{
   6    int input, result, dsp;
   7    int hope;
   8
   9    input = 0x701BA35E;
  10    hope  = 0x701B5D5E;
  11
  12    __asm
  13        ("absq_s.qb %0, %1\n\t"
  14         : "=r"(result)
  15         : "r"(input)
  16        );
  17    assert(result == hope);
  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    assert(dsp == 1);
  32    assert(result == hope);
  33
  34    return 0;
  35}
  36