Skip to content

Commit b542509

Browse files
authored
[compiler-rt] Fix declarations of builtins in test files (llvm#161222)
Replace `long double` and `long double _Complex` with `fp_t` and `Qcomplex` in the test files. This prepares for reapplying 6567070 and running tests on targets where `fp_t` is not `long double`.
1 parent 62e7e8d commit b542509

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

compiler-rt/test/builtins/Unit/fixunstfdi_test.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@
66

77
#if _ARCH_PPC || __aarch64__ || __arm64ec__
88

9+
#define QUAD_PRECISION
10+
#include "fp_lib.h"
11+
912
#include "int_lib.h"
1013

1114
// Returns: convert a to a unsigned long long, rounding toward zero.
1215
// Negative values all become zero.
1316

14-
// Assumption: long double is a 128 bit floating point type
17+
// Assumption: fp_t is a 128 bit floating point type
1518
// du_int is a 64 bit integral type
16-
// value in long double is representable in du_int or is negative
19+
// value in fp_t is representable in du_int or is negative
1720
// (no range checking performed)
1821

19-
COMPILER_RT_ABI du_int __fixunstfdi(long double a);
22+
COMPILER_RT_ABI du_int __fixunstfdi(fp_t a);
2023

21-
int test__fixunstfdi(long double a, du_int expected)
24+
int test__fixunstfdi(fp_t a, du_int expected)
2225
{
2326
du_int x = __fixunstfdi(a);
2427
if (x != expected)
@@ -29,7 +32,7 @@ int test__fixunstfdi(long double a, du_int expected)
2932

3033
char assumption_1[sizeof(du_int) == 2*sizeof(su_int)] = {0};
3134
char assumption_2[sizeof(du_int)*CHAR_BIT == 64] = {0};
32-
char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0};
35+
char assumption_3[sizeof(fp_t)*CHAR_BIT == 128] = {0};
3336

3437
#endif
3538

compiler-rt/test/builtins/Unit/multc3_test.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@
66

77
#if _ARCH_PPC || __aarch64__ || __arm64ec__
88

9+
#define QUAD_PRECISION
10+
#include "fp_lib.h"
11+
912
#include "int_lib.h"
1013
#include <math.h>
1114
#include <complex.h>
1215

1316
// Returns: the product of a + ib and c + id
1417

15-
COMPILER_RT_ABI long double _Complex
16-
__multc3(long double __a, long double __b, long double __c, long double __d);
18+
COMPILER_RT_ABI Qcomplex
19+
__multc3(fp_t __a, fp_t __b, fp_t __c, fp_t __d);
1720

1821
enum {zero, non_zero, inf, NaN, non_zero_nan};
1922

2023
int
21-
classify(long double _Complex x)
24+
classify(Qcomplex x)
2225
{
2326
if (x == 0)
2427
return zero;
@@ -41,13 +44,13 @@ classify(long double _Complex x)
4144
return non_zero;
4245
}
4346

44-
int test__multc3(long double a, long double b, long double c, long double d)
47+
int test__multc3(fp_t a, fp_t b, fp_t c, fp_t d)
4548
{
46-
long double _Complex r = __multc3(a, b, c, d);
49+
Qcomplex r = __multc3(a, b, c, d);
4750
// printf("test__multc3(%Lf, %Lf, %Lf, %Lf) = %Lf + I%Lf\n",
4851
// a, b, c, d, creall(r), cimagl(r));
49-
long double _Complex dividend;
50-
long double _Complex divisor;
52+
Qcomplex dividend;
53+
Qcomplex divisor;
5154

5255
__real__ dividend = a;
5356
__imag__ dividend = b;
@@ -188,7 +191,7 @@ int test__multc3(long double a, long double b, long double c, long double d)
188191
return 0;
189192
}
190193

191-
long double x[][2] =
194+
fp_t x[][2] =
192195
{
193196
{ 1.e-6, 1.e-6},
194197
{-1.e-6, 1.e-6},

0 commit comments

Comments
 (0)