Skip to content

Commit 4f3f496

Browse files
committed
Add attributes to match the C++ version
1 parent 8e687ef commit 4f3f496

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/benchmark_libdfp.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <time.h>
99
#include <inttypes.h>
1010

11-
#define K 20000000
11+
#define K 2000000
1212
#define N 5
1313

1414
double float_rand(double min, double max)
@@ -17,7 +17,7 @@ double float_rand(double min, double max)
1717
return min + scale * (max - min);
1818
}
1919

20-
void generate_vector_32(_Decimal32* buffer, size_t buffer_len)
20+
__attribute__ ((__noinline__)) void generate_vector_32(_Decimal32* buffer, size_t buffer_len)
2121
{
2222
size_t i = 0;
2323
while (i < buffer_len)
@@ -27,7 +27,7 @@ void generate_vector_32(_Decimal32* buffer, size_t buffer_len)
2727
}
2828
}
2929

30-
void test_comparisons_32(_Decimal32* data, const char* label)
30+
__attribute__ ((__noinline__)) void test_comparisons_32(_Decimal32* data, const char* label)
3131
{
3232
struct timespec t1, t2;
3333
clock_gettime(CLOCK_MONOTONIC, &t1);
@@ -56,7 +56,7 @@ void test_comparisons_32(_Decimal32* data, const char* label)
5656
printf("Comparisons <%-10s >: %-10" PRIu64 " us (s=%zu)\n", label, elapsed_time_us, s);
5757
}
5858

59-
void generate_vector_64(_Decimal64* buffer, size_t buffer_len)
59+
__attribute__ ((__noinline__)) void generate_vector_64(_Decimal64* buffer, size_t buffer_len)
6060
{
6161
size_t i = 0;
6262
while (i < buffer_len)
@@ -66,7 +66,7 @@ void generate_vector_64(_Decimal64* buffer, size_t buffer_len)
6666
}
6767
}
6868

69-
void test_comparisons_64(_Decimal64* data, const char* label)
69+
__attribute__ ((__noinline__)) void test_comparisons_64(_Decimal64* data, const char* label)
7070
{
7171
struct timespec t1, t2;
7272
clock_gettime(CLOCK_MONOTONIC, &t1);
@@ -95,7 +95,7 @@ void test_comparisons_64(_Decimal64* data, const char* label)
9595
printf("Comparisons <%-10s >: %-10" PRIu64 " us (s=%zu)\n", label, elapsed_time_us, s);
9696
}
9797

98-
void generate_vector_128(_Decimal128* buffer, size_t buffer_len)
98+
__attribute__ ((__noinline__)) void generate_vector_128(_Decimal128* buffer, size_t buffer_len)
9999
{
100100
size_t i = 0;
101101
while (i < buffer_len)
@@ -105,7 +105,7 @@ void generate_vector_128(_Decimal128* buffer, size_t buffer_len)
105105
}
106106
}
107107

108-
void test_comparisons_128(_Decimal128* data, const char* label)
108+
__attribute__ ((__noinline__)) void test_comparisons_128(_Decimal128* data, const char* label)
109109
{
110110
struct timespec t1, t2;
111111
clock_gettime(CLOCK_MONOTONIC, &t1);
@@ -155,7 +155,7 @@ _Decimal32 div_32(_Decimal32 a, _Decimal32 b)
155155
return a / b;
156156
}
157157

158-
void test_two_element_operation_32(_Decimal32* data, operation_32 op, const char* label, const char* op_label)
158+
__attribute__ ((__noinline__)) void test_two_element_operation_32(_Decimal32* data, operation_32 op, const char* label, const char* op_label)
159159
{
160160
struct timespec t1, t2;
161161
clock_gettime(CLOCK_MONOTONIC, &t1);
@@ -200,7 +200,7 @@ _Decimal64 div_64(_Decimal64 a, _Decimal64 b)
200200
return a / b;
201201
}
202202

203-
void test_two_element_operation_64(_Decimal64* data, operation_64 op, const char* label, const char* op_label)
203+
__attribute__ ((__noinline__)) void test_two_element_operation_64(_Decimal64* data, operation_64 op, const char* label, const char* op_label)
204204
{
205205
struct timespec t1, t2;
206206
clock_gettime(CLOCK_MONOTONIC, &t1);
@@ -245,7 +245,7 @@ _Decimal128 div_128(_Decimal128 a, _Decimal128 b)
245245
return a / b;
246246
}
247247

248-
void test_two_element_operation_128(_Decimal128* data, operation_128 op, const char* label, const char* op_label)
248+
__attribute__ ((__noinline__)) void test_two_element_operation_128(_Decimal128* data, operation_128 op, const char* label, const char* op_label)
249249
{
250250
struct timespec t1, t2;
251251
clock_gettime(CLOCK_MONOTONIC, &t1);

0 commit comments

Comments
 (0)