1 // REQUIRES: target-is-powerpc64le
2 // RUN: %clang_builtins %s %librt -o %t && %run %t
3 #include <stdint.h>
4 #include <stdio.h>
5 #include "int_lib.h"
6 
7 COMPILER_RT_ABI long double __floatditf(int64_t);
8 
9 #include "floatunditf_test.h"
10 #include "DD.h"
11 
main(int argc,char * argv[])12 int main(int argc, char *argv[]) {
13 	int i;
14 
15 	DD expected;
16 	DD computed;
17 
18 	for (i=0; i<numTests; ++i) {
19 		expected.hi = tests[i].hi;
20 		expected.lo = tests[i].lo;
21 		computed.ld = __floatditf(tests[i].input);
22 
23 		if ((computed.hi != expected.hi) || (computed.lo != expected.lo))
24 		{
25 			printf("Error on __floatunditf( 0x%016llx ):\n", tests[i].input);
26 			printf("\tExpected %La = ( %a , %a )\n", expected.ld, expected.hi, expected.lo);
27 			printf("\tComputed %La = ( %a , %a )\n", computed.ld, computed.hi, computed.lo);
28 			return 1;
29 		}
30 	}
31 
32 	return 0;
33 }
34