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