[Builtin] Implement lit-test support (part 1 of 2: test cases update)
Original r297566 is splitted into two parts.
This is part one, which adds "RUN" command for test cases.
Unit/arm/call_apsr.S is updated to support thumb1.
It also fixes a bug in arm/aeabi_uldivmod_test.c
gcc_personality_test is XFAILED as the framework cannot handle it so far.
cpu_model_test is also XFAILED for now as it is expected to return non-zero.
TODO: A few tests are XFAILed for armhf and aarch64.
We need further investigating. [1,2] Tracks the issue.
[1] https://bugs.llvm.org//show_bug.cgi?id=32260
[2] https://bugs.llvm.org//show_bug.cgi?id=32261
Reviewers: rengolin, compnerd, jroelofs, erik.pilkington, arphaman
Reviewed By: jroelofs
Subscribers: jroelofs, aemerson, srhines, nemanjai, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D30802
llvm-svn: 298339
2017-03-21 13:32:51 +08:00
|
|
|
// RUN: %clang_builtins %s %librt -o %t && %run %t
|
[Builtins] Provide a mechanism to selectively disable tests based on whether an implementation is provided by a builtin library.
Summary:
If a platform removes some builtin implementations (e.g. via the
Darwin-excludes mechanism) then this can lead to test failures because
the test expects an implementation to be available.
To solve this lit features are added for each configuration based
on which sources are included in the builtin library. The features
are of the form `librt_has_<name>` where `<name>` is the name of the
source file with the file extension removed. This handles C and
assembly sources.
With the lit features in place it is possible to make certain tests
require them.
Example:
```
REQUIRES: librt_has_comparedf2
```
All top-level tests in `test/builtins/Unit` (i.e. not under
`arm`, `ppc`, and `riscv`) have been annotated with the appropriate
`REQUIRES: librt_has_*` statement.
rdar://problem/55520987
Reviewers: beanz, steven_wu, arphaman, dexonsmith, phosek, thakis
Subscribers: mgorny, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D68064
llvm-svn: 375150
2019-10-18 02:12:49 +08:00
|
|
|
// REQUIRES: librt_has_fixxfdi
|
2009-06-27 00:47:03 +08:00
|
|
|
|
|
|
|
#include "int_lib.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2009-09-12 03:09:36 +08:00
|
|
|
|
|
|
|
#if HAS_80_BIT_LONG_DOUBLE
|
2009-06-27 00:47:03 +08:00
|
|
|
// Returns: convert a to a signed long long, rounding toward zero.
|
|
|
|
|
|
|
|
// Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
|
|
|
|
// su_int is a 32 bit integral type
|
|
|
|
// value in long double is representable in di_int (no range checking performed)
|
|
|
|
|
|
|
|
// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
|
|
|
// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
|
|
|
|
2018-10-31 04:51:27 +08:00
|
|
|
COMPILER_RT_ABI di_int __fixxfdi(long double a);
|
2009-06-27 00:47:03 +08:00
|
|
|
|
|
|
|
int test__fixxfdi(long double a, di_int expected)
|
|
|
|
{
|
|
|
|
di_int x = __fixxfdi(a);
|
|
|
|
if (x != expected)
|
|
|
|
printf("error in __fixxfdi(%LA) = %llX, expected %llX\n",
|
|
|
|
a, x, expected);
|
|
|
|
return x != expected;
|
|
|
|
}
|
|
|
|
|
|
|
|
char assumption_1[sizeof(di_int) == 2*sizeof(si_int)] = {0};
|
|
|
|
char assumption_2[sizeof(su_int)*CHAR_BIT == 32] = {0};
|
|
|
|
char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2009-09-12 03:09:36 +08:00
|
|
|
#if HAS_80_BIT_LONG_DOUBLE
|
2009-06-27 00:47:03 +08:00
|
|
|
if (test__fixxfdi(0.0, 0))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (test__fixxfdi(0.5, 0))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(0.99, 0))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(1.0, 1))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(1.5, 1))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(1.99, 1))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(2.0, 2))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(2.01, 2))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-0.5, 0))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-0.99, 0))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-1.0, -1))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-1.5, -1))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-1.99, -1))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-2.0, -2))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-2.01, -2))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (test__fixxfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000LL))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000LL))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (test__fixxfdi(-0x1.FFFFFEp+62, 0x8000008000000000LL))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-0x1.FFFFFCp+62, 0x8000010000000000LL))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (test__fixxfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00LL))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800LL))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (test__fixxfdi(-0x1.FFFFFFFFFFFFFp+62, 0x8000000000000400LL))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-0x1.FFFFFFFFFFFFEp+62, 0x8000000000000800LL))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (test__fixxfdi(0x1.FFFFFFFFFFFFFFFCp+62L, 0x7FFFFFFFFFFFFFFFLL))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(0x1.FFFFFFFFFFFFFFF8p+62L, 0x7FFFFFFFFFFFFFFELL))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (test__fixxfdi(-0x1.0000000000000000p+63L, 0x8000000000000000LL))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-0x1.FFFFFFFFFFFFFFFCp+62L, 0x8000000000000001LL))
|
|
|
|
return 1;
|
|
|
|
if (test__fixxfdi(-0x1.FFFFFFFFFFFFFFF8p+62L, 0x8000000000000002LL))
|
|
|
|
return 1;
|
|
|
|
|
2011-05-30 05:43:29 +08:00
|
|
|
#else
|
|
|
|
printf("skipped\n");
|
2009-06-27 00:47:03 +08:00
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|