(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
advsimd-intrinsics/
vabs.c
       1  #define INSN_NAME vabs
       2  #define TEST_MSG "VABS/VABSQ"
       3  
       4  /* Extra tests for functions requiring floating-point types.  */
       5  void exec_vabs_f32(void);
       6  #define EXTRA_TESTS exec_vabs_f32
       7  
       8  #include "unary_op.inc"
       9  
      10  /* Expected results.  */
      11  VECT_VAR_DECL(expected,int,8,8) [] = { 0x10, 0xf, 0xe, 0xd,
      12  				       0xc, 0xb, 0xa, 0x9 };
      13  VECT_VAR_DECL(expected,int,16,4) [] = { 0x10, 0xf, 0xe, 0xd };
      14  VECT_VAR_DECL(expected,int,32,2) [] = { 0x10, 0xf };
      15  VECT_VAR_DECL(expected,int,8,16) [] = { 0x10, 0xf, 0xe, 0xd, 0xc, 0xb, 0xa, 0x9,
      16  					0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1 };
      17  VECT_VAR_DECL(expected,int,16,8) [] = { 0x10, 0xf, 0xe, 0xd,
      18  					0xc, 0xb, 0xa, 0x9 };
      19  VECT_VAR_DECL(expected,int,32,4) [] = { 0x10, 0xf, 0xe, 0xd };
      20  
      21  /* Expected results for float32 variants. Needs to be separated since
      22     the generic test function does not test floating-point
      23     versions.  */
      24  #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
      25  VECT_VAR_DECL(expected_float16, hfloat, 16, 4) [] = { 0x409a, 0x409a,
      26  						      0x409a, 0x409a };
      27  VECT_VAR_DECL(expected_float16, hfloat, 16, 8) [] = { 0x42cd, 0x42cd,
      28  						      0x42cd, 0x42cd,
      29  						      0x42cd, 0x42cd,
      30  						      0x42cd, 0x42cd };
      31  #endif
      32  VECT_VAR_DECL(expected_float32,hfloat,32,2) [] = { 0x40133333, 0x40133333 };
      33  VECT_VAR_DECL(expected_float32,hfloat,32,4) [] = { 0x4059999a, 0x4059999a,
      34  						   0x4059999a, 0x4059999a };
      35  
      36  void exec_vabs_f32(void)
      37  {
      38  #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
      39    DECL_VARIABLE(vector, float, 16, 4);
      40    DECL_VARIABLE(vector, float, 16, 8);
      41  #endif
      42    DECL_VARIABLE(vector, float, 32, 2);
      43    DECL_VARIABLE(vector, float, 32, 4);
      44  
      45  #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
      46    DECL_VARIABLE(vector_res, float, 16, 4);
      47    DECL_VARIABLE(vector_res, float, 16, 8);
      48  #endif
      49    DECL_VARIABLE(vector_res, float, 32, 2);
      50    DECL_VARIABLE(vector_res, float, 32, 4);
      51  
      52  #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
      53    VDUP(vector, , float, f, 16, 4, -2.3f);
      54    VDUP(vector, q, float, f, 16, 8, 3.4f);
      55  #endif
      56    VDUP(vector, , float, f, 32, 2, -2.3f);
      57    VDUP(vector, q, float, f, 32, 4, 3.4f);
      58  
      59  #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
      60    TEST_UNARY_OP(INSN_NAME, , float, f, 16, 4);
      61    TEST_UNARY_OP(INSN_NAME, q, float, f, 16, 8);
      62  #endif
      63    TEST_UNARY_OP(INSN_NAME, , float, f, 32, 2);
      64    TEST_UNARY_OP(INSN_NAME, q, float, f, 32, 4);
      65  
      66  #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
      67    CHECK_FP(TEST_MSG, float, 16, 4, PRIx16, expected_float16, "");
      68    CHECK_FP(TEST_MSG, float, 16, 8, PRIx16, expected_float16, "");
      69  #endif
      70    CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected_float32, "");
      71    CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected_float32, "");
      72  }