[X86] Split rr/rm CVT schedules on SNB/HSW/BDW (#117494)
[llvm-project.git] / compiler-rt / test / builtins / timing / floatdisf.c
blob801ab0aa2e60b6cca59caa5e95015578015d735d
1 #include "timing.h"
2 #include <stdio.h>
4 #define INPUT_TYPE int64_t
5 #define INPUT_SIZE 512
6 #define FUNCTION_NAME __floatdisf
8 #ifndef LIBNAME
9 #define LIBNAME UNKNOWN
10 #endif
12 #define LIBSTRING LIBSTRINGX(LIBNAME)
13 #define LIBSTRINGX(a) LIBSTRINGXX(a)
14 #define LIBSTRINGXX(a) #a
16 float FUNCTION_NAME(INPUT_TYPE x);
18 int main(int argc, char *argv[]) {
19 INPUT_TYPE input[INPUT_SIZE];
20 int i, j;
22 srand(42);
24 // Initialize the input array with data of various sizes.
25 for (i=0; i<INPUT_SIZE; ++i)
26 input[i] = (((uint64_t)rand() << 32) | (uint64_t)rand()) >> (rand() & 63);
28 double bestTime = __builtin_inf();
29 void *dummyp;
30 for (j=0; j<1024; ++j) {
32 uint64_t startTime = mach_absolute_time();
33 for (i=0; i<INPUT_SIZE; ++i)
34 FUNCTION_NAME(input[i]);
35 uint64_t endTime = mach_absolute_time();
37 double thisTime = intervalInCycles(startTime, endTime);
38 bestTime = __builtin_fmin(thisTime, bestTime);
40 // Move the stack alignment between trials to eliminate (mostly) aliasing effects
41 dummyp = alloca(1);
44 printf("%16s: %f cycles.\n", LIBSTRING, bestTime / (double) INPUT_SIZE);
46 return 0;