1e80e978d6aa211056beddf4582390e374d1935abNick Kledzik//===-- ledf2vfp_test.c - Test __ledf2vfp ---------------------------------===//
2e80e978d6aa211056beddf4582390e374d1935abNick Kledzik//
3e80e978d6aa211056beddf4582390e374d1935abNick Kledzik//                     The LLVM Compiler Infrastructure
4e80e978d6aa211056beddf4582390e374d1935abNick Kledzik//
59ad441ffec97db647fee3725b3424284fb913e14Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open
69ad441ffec97db647fee3725b3424284fb913e14Howard Hinnant// Source Licenses. See LICENSE.TXT for details.
7e80e978d6aa211056beddf4582390e374d1935abNick Kledzik//
8e80e978d6aa211056beddf4582390e374d1935abNick Kledzik//===----------------------------------------------------------------------===//
9e80e978d6aa211056beddf4582390e374d1935abNick Kledzik//
10e80e978d6aa211056beddf4582390e374d1935abNick Kledzik// This file tests __ledf2vfp for the compiler_rt library.
11e80e978d6aa211056beddf4582390e374d1935abNick Kledzik//
12e80e978d6aa211056beddf4582390e374d1935abNick Kledzik//===----------------------------------------------------------------------===//
13e80e978d6aa211056beddf4582390e374d1935abNick Kledzik
14e80e978d6aa211056beddf4582390e374d1935abNick Kledzik#include <stdlib.h>
15e80e978d6aa211056beddf4582390e374d1935abNick Kledzik#include <stdint.h>
16e80e978d6aa211056beddf4582390e374d1935abNick Kledzik#include <stdio.h>
17e80e978d6aa211056beddf4582390e374d1935abNick Kledzik#include <math.h>
18e80e978d6aa211056beddf4582390e374d1935abNick Kledzik
19e80e978d6aa211056beddf4582390e374d1935abNick Kledzik
20e80e978d6aa211056beddf4582390e374d1935abNick Kledzikextern int __ledf2vfp(double a, double b);
21e80e978d6aa211056beddf4582390e374d1935abNick Kledzik
22e80e978d6aa211056beddf4582390e374d1935abNick Kledzik#if __arm__
23e80e978d6aa211056beddf4582390e374d1935abNick Kledzikint test__ledf2vfp(double a, double b)
24e80e978d6aa211056beddf4582390e374d1935abNick Kledzik{
25e80e978d6aa211056beddf4582390e374d1935abNick Kledzik    int actual = __ledf2vfp(a, b);
26e80e978d6aa211056beddf4582390e374d1935abNick Kledzik	int expected = (a <= b) ? 1 : 0;
27e80e978d6aa211056beddf4582390e374d1935abNick Kledzik    if (actual != expected)
28e80e978d6aa211056beddf4582390e374d1935abNick Kledzik        printf("error in __ledf2vfp(%f, %f) = %d, expected %d\n",
29e80e978d6aa211056beddf4582390e374d1935abNick Kledzik               a, b, actual, expected);
30e80e978d6aa211056beddf4582390e374d1935abNick Kledzik    return actual != expected;
31e80e978d6aa211056beddf4582390e374d1935abNick Kledzik}
32e80e978d6aa211056beddf4582390e374d1935abNick Kledzik#endif
33e80e978d6aa211056beddf4582390e374d1935abNick Kledzik
34e80e978d6aa211056beddf4582390e374d1935abNick Kledzikint main()
35e80e978d6aa211056beddf4582390e374d1935abNick Kledzik{
36e80e978d6aa211056beddf4582390e374d1935abNick Kledzik#if __arm__
37e80e978d6aa211056beddf4582390e374d1935abNick Kledzik    if (test__ledf2vfp(0.0, 0.0))
38e80e978d6aa211056beddf4582390e374d1935abNick Kledzik        return 1;
39e80e978d6aa211056beddf4582390e374d1935abNick Kledzik    if (test__ledf2vfp(1.0, 1.0))
40e80e978d6aa211056beddf4582390e374d1935abNick Kledzik        return 1;
41e80e978d6aa211056beddf4582390e374d1935abNick Kledzik    if (test__ledf2vfp(-1.0, -2.0))
42e80e978d6aa211056beddf4582390e374d1935abNick Kledzik        return 1;
43e80e978d6aa211056beddf4582390e374d1935abNick Kledzik    if (test__ledf2vfp(-2.0, -1.0))
44e80e978d6aa211056beddf4582390e374d1935abNick Kledzik        return 1;
45e80e978d6aa211056beddf4582390e374d1935abNick Kledzik    if (test__ledf2vfp(HUGE_VAL, 1.0))
46e80e978d6aa211056beddf4582390e374d1935abNick Kledzik        return 1;
47e80e978d6aa211056beddf4582390e374d1935abNick Kledzik    if (test__ledf2vfp(1.0, HUGE_VAL))
48e80e978d6aa211056beddf4582390e374d1935abNick Kledzik        return 1;
497482815716cd9b87931d82dca7298fc3c707229fJoerg Sonnenberger#else
507482815716cd9b87931d82dca7298fc3c707229fJoerg Sonnenberger    printf("skipped\n");
51e80e978d6aa211056beddf4582390e374d1935abNick Kledzik#endif
52e80e978d6aa211056beddf4582390e374d1935abNick Kledzik    return 0;
53e80e978d6aa211056beddf4582390e374d1935abNick Kledzik}
54