lib: Starting thinning out the dependency on math.h by using compiler builtins
where available.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@144785 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/int_math.h b/lib/int_math.h
new file mode 100644
index 0000000..856889d
--- /dev/null
+++ b/lib/int_math.h
@@ -0,0 +1,28 @@
+/* ===-- int_math.h - internal math inlines ---------------------------------===
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ * ===-----------------------------------------------------------------------===
+ *
+ * This file is not part of the interface of this library.
+ *
+ * This file defines substitutes for the libm functions used in some of the
+ * compiler-rt implementations, defined in such a way that there is not a direct
+ * dependency on libm or math.h. Instead, we use the compiler builtin versions
+ * where available. This reduces our dependencies on the system SDK by foisting
+ * the responsibility onto the compiler.
+ *
+ * ===-----------------------------------------------------------------------===
+ */
+
+#ifndef INT_MATH_H
+#define INT_MATH_H
+
+#define crt_isfinite(x) __builtin_isfinite((x))
+#define crt_isinf(x) __builtin_isinf((x))
+#define crt_isnan(x) __builtin_isnan((x))
+
+#endif /* INT_MATH_H */