qemu/tests/tcg/openrisc/test_lf_ges.c
<<
>>
Prefs
   1#include <stdio.h>
   2
   3int main(void)
   4{
   5    int a, result;
   6    float b, c;
   7
   8    a = 0;
   9    b = 122.5;
  10    c = 123.5;
  11    result = 0x1;
  12    __asm
  13    ("lfges:\n\t"
  14     "l.addi    %0, %0, 0x1\n\t"
  15     "lf.sfge.s %1, %2\n\t"
  16     "l.bf      lfges\n\t"
  17     "l.nop\n\t"
  18     : "+r"(a)
  19     : "r"(b), "r"(c)
  20    );
  21    if (a != result) {
  22        printf("lf.sfge.s error\n");
  23        return -1;
  24    }
  25
  26    b = 133.5;
  27    c = 13.5;
  28    result = 0x3;
  29    __asm
  30    ("l.addi    %0, %0, 0x1\n\t"
  31     "l.addi    %0, %0, 0x1\n\t"
  32     "lf.sfge.s %1, %2\n\t"
  33     "l.bf      1f\n\t"
  34     "l.nop\n\t"
  35     "l.addi    %0, %0, 0x1\n\t"
  36     "l.addi    %0, %0, 0x1\n\t"
  37     "1:\n\t"
  38     : "+r"(a)
  39     : "r"(b), "r"(c)
  40    );
  41    if (a != result) {
  42        printf("lf.sfge.s error\n");
  43        return -1;
  44    }
  45
  46/*    int a, result;
  47    double b, c;
  48
  49    a = 0x1;
  50    b = 122.5;
  51    c = 123.5;
  52    result = 0x2;
  53    __asm
  54    ("lfged:\n\t"
  55     "l.addi    %0, %0, 0x1\n\t"
  56     "lf.sfge.d %1, %2\n\t"
  57     "l.bf      lfged\n\t"
  58     "l.nop\n\t"
  59     : "+r"(a)
  60     : "r"(b), "r"(c)
  61    );
  62    if (a != result) {
  63        printf("lf.sfge.d error\n");
  64        return -1;
  65    }
  66
  67    b = 133.5;
  68    c = 13.5;
  69    result = 0x4;
  70    __asm
  71    ("lf.sfge.d %1, %2\n\t"
  72     "l.bf      1f\n\t"
  73     "l.nop\n\t"
  74     "l.addi    %0, %0, 0x1\n\t"
  75     "l.addi    %0, %0, 0x1\n\t"
  76     "1:\n\t"
  77     "l.addi    %0, %0, 0x1\n\t"
  78     "l.addi    %0, %0, 0x1\n\t"
  79     : "+r"(a)
  80     : "r"(b), "r"(c)
  81    );
  82    if (a != result) {
  83        printf("lf.sfge.d error\n");
  84        return -1;
  85    }*/
  86
  87    return 0;
  88}
  89