qemu/tests/tcg/openrisc/test_bnf.c
<<
>>
Prefs
   1#include <stdio.h>
   2
   3int main(void)
   4{
   5    int a, b;
   6    int result;
   7
   8    a = 0;
   9    b = 0;
  10    result = 0x3;
  11    __asm
  12    ("l.sfeqi %1, 0x0\n\t"
  13     "l.bnf 1f\n\t"
  14     "l.nop\n\t"
  15     "\n\t"
  16     "l.addi %0, %0, 0x1\n\t"
  17     "l.addi %0, %0, 0x1\n\t"
  18     "\n\t"
  19     "1:\n\t"
  20     "l.addi %0, %0, 0x1\n\t"
  21     : "+r"(a)
  22     : "r"(b)
  23    );
  24    if (a != result) {
  25        printf("l.bnf error\n");
  26        return -1;
  27    }
  28
  29    a = 0;
  30    b = 0;
  31    result = 1;
  32    __asm
  33    ("l.sfeqi %1, 0x1\n\t"
  34     "l.bnf 1f\n\t"
  35     "l.nop\n\t"
  36     "\n\t"
  37     "l.addi %0, %0, 0x1\n\t"
  38     "l.addi %0, %0, 0x1\n\t"
  39     "\n\t"
  40     "1:\n\t"
  41     "l.addi %0, %0, 0x1\n\t"
  42     : "+r"(a)
  43     : "r"(b)
  44    );
  45    if (a != result) {
  46        printf("l.bnf error\n");
  47        return -1;
  48    }
  49
  50    return 0;
  51}
  52