summaryrefslogtreecommitdiff
path: root/test/builtins/Unit/compiler_rt_logb_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/builtins/Unit/compiler_rt_logb_test.c')
-rw-r--r--test/builtins/Unit/compiler_rt_logb_test.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/test/builtins/Unit/compiler_rt_logb_test.c b/test/builtins/Unit/compiler_rt_logb_test.c
index 796765980..c36b19ca3 100644
--- a/test/builtins/Unit/compiler_rt_logb_test.c
+++ b/test/builtins/Unit/compiler_rt_logb_test.c
@@ -1,10 +1,9 @@
// RUN: %clang_builtins %s %librt -o %t && %run %t
//===-- compiler_rt_logb_test.c - Test __compiler_rt_logb -----------------===//
//
-// 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.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -36,7 +35,15 @@ double cases[] = {
-0.0, 0.0, 1, -2, 2, -0.5, 0.5,
};
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
+
int main() {
+ // Do not the run the compiler-rt logb test case if using GLIBC version
+ // < 2.23. Older versions might not compute to the same value as the
+ // compiler-rt value.
+#if __GLIBC_PREREQ(2, 23)
const unsigned N = sizeof(cases) / sizeof(cases[0]);
unsigned i;
for (i = 0; i < N; ++i) {
@@ -58,6 +65,9 @@ int main() {
if (test__compiler_rt_logb(fromRep(signBit ^ x))) return 1;
x >>= 1;
}
+#else
+ printf("skipped\n");
+#endif
return 0;
}