11.1Sjoerg//===-- floatsidfvfp_test.c - Test __floatsidfvfp -------------------------===//
21.1Sjoerg//
31.1Sjoerg//                     The LLVM Compiler Infrastructure
41.1Sjoerg//
51.1Sjoerg// This file is dual licensed under the MIT and the University of Illinois Open
61.1Sjoerg// Source Licenses. See LICENSE.TXT for details.
71.1Sjoerg//
81.1Sjoerg//===----------------------------------------------------------------------===//
91.1Sjoerg//
101.1Sjoerg// This file tests __floatsidfvfp for the compiler_rt library.
111.1Sjoerg//
121.1Sjoerg//===----------------------------------------------------------------------===//
131.1Sjoerg
141.1Sjoerg#include <stdio.h>
151.1Sjoerg#include <stdlib.h>
161.1Sjoerg#include <math.h>
171.1Sjoerg
181.1Sjoerg
191.1Sjoergextern double __floatsidfvfp(int a);
201.1Sjoerg
211.1Sjoerg#if __arm__
221.1Sjoergint test__floatsidfvfp(int a)
231.1Sjoerg{
241.1Sjoerg    double actual = __floatsidfvfp(a);
251.1Sjoerg    double expected = a;
261.1Sjoerg    if (actual != expected)
271.1Sjoerg        printf("error in test__ floatsidfvfp(%d) = %f, expected %f\n",
281.1Sjoerg               a, actual, expected);
291.1Sjoerg    return actual != expected;
301.1Sjoerg}
311.1Sjoerg#endif
321.1Sjoerg
331.1Sjoergint main()
341.1Sjoerg{
351.1Sjoerg#if __arm__
361.1Sjoerg    if (test__floatsidfvfp(0))
371.1Sjoerg        return 1;
381.1Sjoerg    if (test__floatsidfvfp(1))
391.1Sjoerg        return 1;
401.1Sjoerg    if (test__floatsidfvfp(-1))
411.1Sjoerg        return 1;
421.1Sjoerg    if (test__floatsidfvfp(0x7FFFFFFF))
431.1Sjoerg        return 1;
441.1Sjoerg    if (test__floatsidfvfp(0x80000000))
451.1Sjoerg        return 1;
461.1Sjoerg#else
471.1Sjoerg    printf("skipped\n");
481.1Sjoerg#endif
491.1Sjoerg    return 0;
501.1Sjoerg}
51