Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/base/float-point-frm-run-1.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* { dg-options "-O3" } */
3
4 #include "riscv_vector.h"
5 #include <stdio.h>
6 #include <stdint-gcc.h>
7
8 #include "float-point-frm-run.h"
9
10 #define DEFINE_TEST_FUNC(FRM) \
11 vfloat32m1_t __attribute__ ((noinline)) \
12 test_float_point_frm_run_##FRM (vfloat32m1_t op1, vfloat32m1_t op2, size_t vl) \
13 { \
14 vfloat32m1_t result; \
15 \
16 set_frm (0); \
17 \
18 result = __riscv_vfadd_vv_f32m1_rm (op1, result, FRM, vl); \
19 \
20 assert_equal (FRM, get_frm (), "The value of frm should be equal"); \
21 \
22 return result; \
23 }
24
25 #define RUN_TEST_FUNC(FRM, op1, op2, vl) \
26 test_float_point_frm_run_##FRM (op1, op2, vl)
27
28 DEFINE_TEST_FUNC (0)
29 DEFINE_TEST_FUNC (1)
30 DEFINE_TEST_FUNC (2)
31 DEFINE_TEST_FUNC (3)
32 DEFINE_TEST_FUNC (4)
33
34 int
35 main ()
36 {
37 size_t vl = 8;
38 vfloat32m1_t op1;
39 vfloat32m1_t op2;
40
41 set_frm (4);
42
43 RUN_TEST_FUNC (0, op1, op2, vl);
44 assert_equal (4, get_frm (), "The value of frm should be equal");
45
46 RUN_TEST_FUNC (1, op1, op2, vl);
47 assert_equal (4, get_frm (), "The value of frm should be equal");
48
49 RUN_TEST_FUNC (2, op1, op2, vl);
50 assert_equal (4, get_frm (), "The value of frm should be equal");
51
52 RUN_TEST_FUNC (3, op1, op2, vl);
53 assert_equal (4, get_frm (), "The value of frm should be equal");
54
55 RUN_TEST_FUNC (4, op1, op2, vl);
56 assert_equal (4, get_frm (), "The value of frm should be equal");
57
58 return 0;
59 }