| 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_llroundf) |
| 14 |
TEST_ASSERT (int64_t) |
| 15 |
|
| 16 |
TEST_INIT_CVT (float, 0.0, int64_t, __builtin_llroundf (-0.0), 1) |
| 17 |
TEST_INIT_CVT (float, -0.0, int64_t, __builtin_llroundf (-0.0), 2) |
| 18 |
TEST_INIT_CVT (float, 1.2, int64_t, __builtin_llroundf (1.2), 3) |
| 19 |
TEST_INIT_CVT (float, -1.2, int64_t, __builtin_llroundf (-1.2), 4) |
| 20 |
TEST_INIT_CVT (float, 1.5, int64_t, __builtin_llroundf (1.5), 5) |
| 21 |
TEST_INIT_CVT (float, -1.5, int64_t, __builtin_llroundf (-1.5), 6) |
| 22 |
TEST_INIT_CVT (float, 1.8, int64_t, __builtin_llroundf (1.8), 7) |
| 23 |
TEST_INIT_CVT (float, -1.8, int64_t, __builtin_llroundf (-1.8), 8) |
| 24 |
TEST_INIT_CVT (float, 0.2, int64_t, __builtin_llroundf (0.2), 9) |
| 25 |
TEST_INIT_CVT (float, -0.2, int64_t, __builtin_llroundf (-0.2), 10) |
| 26 |
TEST_INIT_CVT (float, 0.5, int64_t, __builtin_llroundf (0.5), 11) |
| 27 |
TEST_INIT_CVT (float, -0.5, int64_t, __builtin_llroundf (-0.5), 12) |
| 28 |
TEST_INIT_CVT (float, 0.8, int64_t, __builtin_llroundf (0.8), 13) |
| 29 |
TEST_INIT_CVT (float, -0.8, int64_t, __builtin_llroundf (-0.8), 14) |
| 30 |
TEST_INIT_CVT (float, 4.0, int64_t, __builtin_llroundf (4.0), 15) |
| 31 |
TEST_INIT_CVT (float, -4.0, int64_t, __builtin_llroundf (-4.0), 16) |
| 32 |
TEST_INIT_CVT (float, 8388607.5, int64_t, __builtin_llroundf (8388607.5), 17) |
| 33 |
TEST_INIT_CVT (float, 8388609.0, int64_t, __builtin_llroundf (8388609.0), 18) |
| 34 |
TEST_INIT_CVT (float, -8388607.5, int64_t, __builtin_llroundf (-8388607.5), 19) |
| 35 |
TEST_INIT_CVT (float, -8388609.0, int64_t, __builtin_llroundf (-8388609.0), 20) |
| 36 |
TEST_INIT_CVT (float, 2147483520.0, int64_t, __builtin_llroundf (2147483520.0), 21) |
| 37 |
TEST_INIT_CVT (float, 2147483648.0, int64_t, __builtin_llroundf (2147483648.0), 22) |
| 38 |
TEST_INIT_CVT (float, -2147483648.0, int64_t, __builtin_llroundf (-2147483648.0), 23) |
| 39 |
TEST_INIT_CVT (float, -2147483904.0, int64_t, __builtin_llroundf (-2147483904.0), 24) |
| 40 |
TEST_INIT_CVT (float, 9223371487098961920.0, int64_t, __builtin_llroundf (9223371487098961920.0), 25) |
| 41 |
TEST_INIT_CVT (float, 9223372036854775808.0, int64_t, 0x7fffffffffffffff, 26) |
| 42 |
TEST_INIT_CVT (float, -9223372036854775808.0, int64_t, __builtin_llroundf (-9223372036854775808.0), 27) |
| 43 |
TEST_INIT_CVT (float, -9223373136366403584.0, int64_t, 0x8000000000000000, 28) |
| 44 |
TEST_INIT_CVT (float, __builtin_inf (), int64_t, __builtin_llroundf (__builtin_inf ()), 29) |
| 45 |
TEST_INIT_CVT (float, -__builtin_inf (), int64_t, __builtin_llroundf (-__builtin_inf ()), 30) |
| 46 |
TEST_INIT_CVT (float, __builtin_nan (""), int64_t, 0x7fffffffffffffff, 31) |
| 47 |
|
| 48 |
int64_t |
| 49 |
main () |
| 50 |
{ |
| 51 |
RUN_TEST_CVT (float, int64_t, 1, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 52 |
RUN_TEST_CVT (float, int64_t, 2, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 53 |
RUN_TEST_CVT (float, int64_t, 3, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 54 |
RUN_TEST_CVT (float, int64_t, 4, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 55 |
RUN_TEST_CVT (float, int64_t, 5, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 56 |
RUN_TEST_CVT (float, int64_t, 6, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 57 |
RUN_TEST_CVT (float, int64_t, 7, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 58 |
RUN_TEST_CVT (float, int64_t, 8, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 59 |
RUN_TEST_CVT (float, int64_t, 9, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 60 |
RUN_TEST_CVT (float, int64_t, 10, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 61 |
RUN_TEST_CVT (float, int64_t, 11, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 62 |
RUN_TEST_CVT (float, int64_t, 12, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 63 |
RUN_TEST_CVT (float, int64_t, 13, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 64 |
RUN_TEST_CVT (float, int64_t, 14, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 65 |
RUN_TEST_CVT (float, int64_t, 15, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 66 |
RUN_TEST_CVT (float, int64_t, 16, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 67 |
RUN_TEST_CVT (float, int64_t, 17, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 68 |
RUN_TEST_CVT (float, int64_t, 18, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 69 |
RUN_TEST_CVT (float, int64_t, 19, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 70 |
RUN_TEST_CVT (float, int64_t, 20, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 71 |
RUN_TEST_CVT (float, int64_t, 21, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 72 |
RUN_TEST_CVT (float, int64_t, 22, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 73 |
RUN_TEST_CVT (float, int64_t, 23, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 74 |
RUN_TEST_CVT (float, int64_t, 24, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 75 |
RUN_TEST_CVT (float, int64_t, 25, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 76 |
RUN_TEST_CVT (float, int64_t, 26, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 77 |
RUN_TEST_CVT (float, int64_t, 27, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 78 |
RUN_TEST_CVT (float, int64_t, 28, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 79 |
RUN_TEST_CVT (float, int64_t, 29, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 80 |
RUN_TEST_CVT (float, int64_t, 30, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 81 |
RUN_TEST_CVT (float, int64_t, 31, __builtin_llroundf, in, out, ref, ARRAY_SIZE); |
| 82 |
|
| 83 |
return 0; |
| 84 |
} |