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