qemu/tests/tcg/hexagon/test_round.S
<<
>>
Prefs
   1/*
   2 * Purpose: test example, verify the soundness of the cround operation
   3 * 106 = 0b1101010 with the comma at third digit is 12.5 which is crounded to 12
   4 * but rounded to 13.
   5 */
   6
   7    .text
   8    .globl _start
   9
  10_start:
  11    {
  12        r1 = #200
  13    }
  14    {
  15        r2 = round(r1, #4)
  16    }
  17    {
  18        p0 = cmp.eq(r2, #13); if (p0.new) jump:t test2
  19        jump fail
  20    }
  21
  22test2:
  23    {
  24        r2 = cround(r1, #4)
  25    }
  26    {
  27        p0 = cmp.eq(r2, #12); if (p0.new) jump:t pass
  28        jump fail
  29    }
  30