| 1 |
/* { dg-do run { target { riscv_v } } } */ |
| 2 |
/* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ |
| 3 |
|
| 4 |
#include <stdint-gcc.h> |
| 5 |
#include "test-math.h" |
| 6 |
|
| 7 |
#define ARRAY_SIZE 128 |
| 8 |
|
| 9 |
float in[ARRAY_SIZE]; |
| 10 |
int64_t out[ARRAY_SIZE]; |
| 11 |
int64_t ref[ARRAY_SIZE]; |
| 12 |
|
| 13 |
TEST_UNARY_CALL_CVT (float, int64_t, __builtin_llrintf) |
| 14 |
TEST_ASSERT (int64_t) |
| 15 |
|
| 16 |
|
| 17 |
TEST_INIT_CVT (float, 1.2, int64_t, __builtin_llrintf (1.2), 1) |
| 18 |
TEST_INIT_CVT (float, -1.2, int64_t, __builtin_llrintf (-1.2), 2) |
| 19 |
TEST_INIT_CVT (float, 0.5, int64_t, __builtin_llrintf (0.5), 3) |
| 20 |
TEST_INIT_CVT (float, -0.5, int64_t, __builtin_llrintf (-0.5), 4) |
| 21 |
TEST_INIT_CVT (float, 0.1, int64_t, __builtin_llrintf (0.1), 5) |
| 22 |
TEST_INIT_CVT (float, -0.1, int64_t, __builtin_llrintf (-0.1), 6) |
| 23 |
TEST_INIT_CVT (float, 3.0, int64_t, __builtin_llrintf (3.0), 7) |
| 24 |
TEST_INIT_CVT (float, -3.0, int64_t, __builtin_llrintf (-3.0), 8) |
| 25 |
TEST_INIT_CVT (float, 2147483520.0, int64_t, __builtin_llrintf (2147483520.0), 9) |
| 26 |
TEST_INIT_CVT (float, 2147483648.0, int64_t, __builtin_llrintf (2147483648.0), 10) |
| 27 |
TEST_INIT_CVT (float, -2147483648.0, int64_t, __builtin_llrintf (-2147483648.0), 11) |
| 28 |
TEST_INIT_CVT (float, -2147483904.0, int64_t, __builtin_llrintf (-2147483904.0), 12) |
| 29 |
TEST_INIT_CVT (float, 0.0, int64_t, __builtin_llrintf (-0.0), 13) |
| 30 |
TEST_INIT_CVT (float, -0.0, int64_t, __builtin_llrintf (-0.0), 14) |
| 31 |
TEST_INIT_CVT (float, 9223372036854775807.0, int64_t, __builtin_llrintf (9223372036854775807.0), 15) |
| 32 |
TEST_INIT_CVT (float, 9223373136366403584.0, int64_t, __builtin_llrintf (9223373136366403584.0), 16) |
| 33 |
TEST_INIT_CVT (float, -9223372036854775807.0, int64_t, __builtin_llrintf (-9223372036854775807.0), 17) |
| 34 |
TEST_INIT_CVT (float, -9223373136366403584.0, int64_t, __builtin_llrintf (-9223373136366403584.0), 18) |
| 35 |
TEST_INIT_CVT (float, __builtin_inf (), int64_t, __builtin_llrintf (__builtin_inff ()), 19) |
| 36 |
TEST_INIT_CVT (float, -__builtin_inf (), int64_t, __builtin_llrintf (-__builtin_inff ()), 20) |
| 37 |
TEST_INIT_CVT (float, __builtin_nanf (""), int64_t, 0x7fffffffffffffff, 21) |
| 38 |
|
| 39 |
int |
| 40 |
main () |
| 41 |
{ |
| 42 |
RUN_TEST_CVT (float, int64_t, 1, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 43 |
RUN_TEST_CVT (float, int64_t, 2, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 44 |
RUN_TEST_CVT (float, int64_t, 3, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 45 |
RUN_TEST_CVT (float, int64_t, 4, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 46 |
RUN_TEST_CVT (float, int64_t, 5, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 47 |
RUN_TEST_CVT (float, int64_t, 6, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 48 |
RUN_TEST_CVT (float, int64_t, 7, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 49 |
RUN_TEST_CVT (float, int64_t, 8, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 50 |
RUN_TEST_CVT (float, int64_t, 9, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 51 |
RUN_TEST_CVT (float, int64_t, 10, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 52 |
RUN_TEST_CVT (float, int64_t, 11, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 53 |
RUN_TEST_CVT (float, int64_t, 12, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 54 |
RUN_TEST_CVT (float, int64_t, 13, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 55 |
RUN_TEST_CVT (float, int64_t, 14, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 56 |
RUN_TEST_CVT (float, int64_t, 15, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 57 |
RUN_TEST_CVT (float, int64_t, 16, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 58 |
RUN_TEST_CVT (float, int64_t, 17, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 59 |
RUN_TEST_CVT (float, int64_t, 18, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 60 |
RUN_TEST_CVT (float, int64_t, 19, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 61 |
RUN_TEST_CVT (float, int64_t, 20, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 62 |
RUN_TEST_CVT (float, int64_t, 21, __builtin_llrintf, in, out, ref, ARRAY_SIZE); |
| 63 |
|
| 64 |
return 0; |
| 65 |
} |