(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
advsimd-intrinsics/
vadd.c
       1  #define INSN_NAME vadd
       2  #define TEST_MSG "VADD/VADDQ"
       3  
       4  /* Extra tests for functions requiring floating-point types.  */
       5  void exec_vadd_f32(void);
       6  #define EXTRA_TESTS exec_vadd_f32
       7  
       8  #include "binary_op.inc"
       9  
      10  /* Expected results.  */
      11  VECT_VAR_DECL(expected,int,8,8) [] = { 0xf2, 0xf3, 0xf4, 0xf5,
      12  				       0xf6, 0xf7, 0xf8, 0xf9 };
      13  VECT_VAR_DECL(expected,int,16,4) [] = { 0xffec, 0xffed, 0xffee, 0xffef };
      14  VECT_VAR_DECL(expected,int,32,2) [] = { 0xfffffff3, 0xfffffff4 };
      15  VECT_VAR_DECL(expected,int,64,1) [] = { 0x54 };
      16  VECT_VAR_DECL(expected,uint,8,8) [] = { 0x4, 0x5, 0x6, 0x7,
      17  					0x8, 0x9, 0xa, 0xb };
      18  VECT_VAR_DECL(expected,uint,16,4) [] = { 0xe, 0xf, 0x10, 0x11 };
      19  VECT_VAR_DECL(expected,uint,32,2) [] = { 0x18, 0x19 };
      20  VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff2 };
      21  VECT_VAR_DECL(expected,int,8,16) [] = { 0xe6, 0xe7, 0xe8, 0xe9,
      22  					0xea, 0xeb, 0xec, 0xed,
      23  					0xee, 0xef, 0xf0, 0xf1,
      24  					0xf2, 0xf3, 0xf4, 0xf5 };
      25  VECT_VAR_DECL(expected,int,16,8) [] = { 0xffdc, 0xffdd, 0xffde, 0xffdf,
      26  					0xffe0, 0xffe1, 0xffe2, 0xffe3 };
      27  VECT_VAR_DECL(expected,int,32,4) [] = { 0xffffffd2, 0xffffffd3,
      28  					0xffffffd4, 0xffffffd5 };
      29  VECT_VAR_DECL(expected,int,64,2) [] = { 0x8, 0x9 };
      30  VECT_VAR_DECL(expected,uint,8,16) [] = { 0xfc, 0xfd, 0xfe, 0xff,
      31  					 0x0, 0x1, 0x2, 0x3,
      32  					 0x4, 0x5, 0x6, 0x7,
      33  					 0x8, 0x9, 0xa, 0xb };
      34  VECT_VAR_DECL(expected,uint,16,8) [] = { 0xfff3, 0xfff4, 0xfff5, 0xfff6,
      35  					 0xfff7, 0xfff8, 0xfff9, 0xfffa };
      36  VECT_VAR_DECL(expected,uint,32,4) [] = { 0x27, 0x28, 0x29, 0x2a };
      37  VECT_VAR_DECL(expected,uint,64,2) [] = { 0xfffffffffffffff3,
      38  					 0xfffffffffffffff4 };
      39  
      40  /* Expected results for float32 variants. Needs to be separated since
      41     the generic test function does not test floating-point
      42     versions.  */
      43  VECT_VAR_DECL(expected_float32,hfloat,32,2) [] = { 0x40d9999a, 0x40d9999a };
      44  VECT_VAR_DECL(expected_float32,hfloat,32,4) [] = { 0x41100000, 0x41100000,
      45  						   0x41100000, 0x41100000 };
      46  #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
      47  VECT_VAR_DECL(expected_float16, hfloat, 16, 4) [] = { 0x46cd, 0x46cd,
      48  						      0x46cd, 0x46cd };
      49  VECT_VAR_DECL(expected_float16, hfloat, 16, 8) [] = { 0x4880, 0x4880,
      50  						      0x4880, 0x4880,
      51  						      0x4880, 0x4880,
      52  						      0x4880, 0x4880 };
      53  #endif
      54  
      55  void exec_vadd_f32(void)
      56  {
      57    DECL_VARIABLE(vector, float, 32, 2);
      58    DECL_VARIABLE(vector, float, 32, 4);
      59  
      60    DECL_VARIABLE(vector2, float, 32, 2);
      61    DECL_VARIABLE(vector2, float, 32, 4);
      62  
      63    DECL_VARIABLE(vector_res, float, 32, 2);
      64    DECL_VARIABLE(vector_res, float, 32, 4);
      65  
      66    VDUP(vector, , float, f, 32, 2, 2.3f);
      67    VDUP(vector, q, float, f, 32, 4, 3.4f);
      68  
      69    VDUP(vector2, , float, f, 32, 2, 4.5f);
      70    VDUP(vector2, q, float, f, 32, 4, 5.6f);
      71  
      72    TEST_BINARY_OP(INSN_NAME, , float, f, 32, 2);
      73    TEST_BINARY_OP(INSN_NAME, q, float, f, 32, 4);
      74  
      75    CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected_float32, "");
      76    CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected_float32, "");
      77  
      78  #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
      79    DECL_VARIABLE(vector, float, 16, 4);
      80    DECL_VARIABLE(vector, float, 16, 8);
      81  
      82    DECL_VARIABLE(vector2, float, 16, 4);
      83    DECL_VARIABLE(vector2, float, 16, 8);
      84  
      85    DECL_VARIABLE(vector_res, float, 16, 4);
      86    DECL_VARIABLE(vector_res, float, 16, 8);
      87  
      88    VDUP(vector, , float, f, 16, 4, 2.3f);
      89    VDUP(vector, q, float, f, 16, 8, 3.4f);
      90  
      91    VDUP(vector2, , float, f, 16, 4, 4.5f);
      92    VDUP(vector2, q, float, f, 16, 8, 5.6f);
      93  
      94    TEST_BINARY_OP(INSN_NAME, , float, f, 16, 4);
      95    TEST_BINARY_OP(INSN_NAME, q, float, f, 16, 8);
      96  
      97    CHECK_FP(TEST_MSG, float, 16, 4, PRIx16, expected_float16, "");
      98    CHECK_FP(TEST_MSG, float, 16, 8, PRIx16, expected_float16, "");
      99  #endif
     100  }