[clang][dataflow][NFC] Fix stale comments. (#71654)
[llvm-project.git] / compiler-rt / test / builtins / timing / ashldi3.c
blob0d7378d4167a409e38f84b2ddda317cda00759c3
1 #include "timing.h"
2 #include <stdio.h>
4 #define INPUT_TYPE int
5 #define INPUT_SIZE 512
6 #define FUNCTION_NAME __ashldi3
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 int64_t FUNCTION_NAME(int64_t input, INPUT_TYPE count);
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] = rand() & 0x3f;
28 int64_t fixedInput = INT64_C(0x1234567890ABCDEF);
30 double bestTime = __builtin_inf();
31 void *dummyp;
32 for (j=0; j<1024; ++j) {
34 uint64_t startTime = mach_absolute_time();
35 for (i=0; i<INPUT_SIZE; ++i)
36 FUNCTION_NAME(fixedInput, input[i]);
37 uint64_t endTime = mach_absolute_time();
39 double thisTime = intervalInCycles(startTime, endTime);
40 bestTime = __builtin_fmin(thisTime, bestTime);
42 // Move the stack alignment between trials to eliminate (mostly) aliasing effects
43 dummyp = alloca(1);
46 printf("%16s: %f cycles.\n", LIBSTRING, bestTime / (double) INPUT_SIZE);
48 return 0;