1b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar#include <stdint.h>
2b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar#include <stdio.h>
3b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
4cdce50bda3603770cc4ef80cbb613c78b8e47a17Pirama Arumuga NainarCOMPILER_RT_ABI long double __floatditf(int64_t);
5b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
6b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar#include "floatunditf_test.h"
7b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar#include "DD.h"
8b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
9b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbarint main(int argc, char *argv[]) {
10b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	int i;
11b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
12b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	DD expected;
13b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	DD computed;
14b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
15b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	for (i=0; i<numTests; ++i) {
16b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar		expected.hi = tests[i].hi;
17b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar		expected.lo = tests[i].lo;
18b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar		computed.ld = __floatditf(tests[i].input);
19b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
20b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar		if ((computed.hi != expected.hi) || (computed.lo != expected.lo))
21b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar		{
22b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar			printf("Error on __floatunditf( 0x%016llx ):\n", tests[i].input);
23b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar			printf("\tExpected %La = ( %a , %a )\n", expected.ld, expected.hi, expected.lo);
24b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar			printf("\tComputed %La = ( %a , %a )\n", computed.ld, computed.hi, computed.lo);
25b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar			return 1;
26b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar		}
27b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	}
28b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
29b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	return 0;
30b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar}
31