(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
advsimd-intrinsics/
vsub.c
       1  #define INSN_NAME vsub
       2  #define TEST_MSG "VSUB/VSUBQ"
       3  
       4  /* Extra tests for functions requiring floating-point types */
       5  void exec_vsub_f32(void);
       6  #define EXTRA_TESTS exec_vsub_f32
       7  
       8  #include "binary_op.inc"
       9  
      10  /* Expected results.  */
      11  VECT_VAR_DECL(expected,int,8,8) [] = { 0xee, 0xef, 0xf0, 0xf1,
      12  				       0xf2, 0xf3, 0xf4, 0xf5 };
      13  VECT_VAR_DECL(expected,int,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 };
      14  VECT_VAR_DECL(expected,int,32,2) [] = { 0xffffffed, 0xffffffee };
      15  VECT_VAR_DECL(expected,int,64,1) [] = { 0xffffffffffffff8c };
      16  VECT_VAR_DECL(expected,uint,8,8) [] = { 0xdc, 0xdd, 0xde, 0xdf,
      17  					0xe0, 0xe1, 0xe2, 0xe3 };
      18  VECT_VAR_DECL(expected,uint,16,4) [] = { 0xffd2, 0xffd3, 0xffd4, 0xffd5 };
      19  VECT_VAR_DECL(expected,uint,32,2) [] = { 0xffffffc8, 0xffffffc9 };
      20  VECT_VAR_DECL(expected,uint,64,1) [] = { 0xffffffffffffffee };
      21  VECT_VAR_DECL(expected,int,8,16) [] = { 0xfa, 0xfb, 0xfc, 0xfd,
      22  					0xfe, 0xff, 0x0, 0x1,
      23  					0x2, 0x3, 0x4, 0x5,
      24  					0x6, 0x7, 0x8, 0x9 };
      25  VECT_VAR_DECL(expected,int,16,8) [] = { 0x4, 0x5, 0x6, 0x7,
      26  					0x8, 0x9, 0xa, 0xb };
      27  VECT_VAR_DECL(expected,int,32,4) [] = { 0xe, 0xf, 0x10, 0x11 };
      28  VECT_VAR_DECL(expected,int,64,2) [] = { 0xffffffffffffffd8,
      29  					0xffffffffffffffd9 };
      30  VECT_VAR_DECL(expected,uint,8,16) [] = { 0xe4, 0xe5, 0xe6, 0xe7,
      31  					 0xe8, 0xe9, 0xea, 0xeb,
      32  					 0xec, 0xed, 0xee, 0xef,
      33  					 0xf0, 0xf1, 0xf2, 0xf3};
      34  VECT_VAR_DECL(expected,uint,16,8) [] = { 0xffed, 0xffee, 0xffef, 0xfff0,
      35  					 0xfff1, 0xfff2, 0xfff3, 0xfff4 };
      36  VECT_VAR_DECL(expected,uint,32,4) [] = { 0xffffffb9, 0xffffffba,
      37  					 0xffffffbb, 0xffffffbc };
      38  VECT_VAR_DECL(expected,uint,64,2) [] = { 0xffffffffffffffed,
      39  					 0xffffffffffffffee };
      40  
      41  /* Expected results for float32 variants. Needs to be separated since
      42     the generic test function does not test floating-point
      43     versions.  */
      44  VECT_VAR_DECL(expected_float32,hfloat,32,2) [] = { 0xc00ccccd, 0xc00ccccd };
      45  VECT_VAR_DECL(expected_float32,hfloat,32,4) [] = { 0xc00ccccc, 0xc00ccccc,
      46  						   0xc00ccccc, 0xc00ccccc };
      47  #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
      48  VECT_VAR_DECL(expected_float16, hfloat, 16, 4) [] = { 0xc066, 0xc066,
      49  						      0xc066, 0xc066 };
      50  VECT_VAR_DECL(expected_float16, hfloat, 16, 8) [] = { 0xc067, 0xc067,
      51  						      0xc067, 0xc067,
      52  						      0xc067, 0xc067,
      53  						      0xc067, 0xc067 };
      54  #endif
      55  
      56  void exec_vsub_f32(void)
      57  {
      58    DECL_VARIABLE(vector, float, 32, 2);
      59    DECL_VARIABLE(vector, float, 32, 4);
      60  
      61    DECL_VARIABLE(vector2, float, 32, 2);
      62    DECL_VARIABLE(vector2, float, 32, 4);
      63  
      64    DECL_VARIABLE(vector_res, float, 32, 2);
      65    DECL_VARIABLE(vector_res, float, 32, 4);
      66  
      67    VDUP(vector, , float, f, 32, 2, 2.3f);
      68    VDUP(vector, q, float, f, 32, 4, 3.4f);
      69  
      70    VDUP(vector2, , float, f, 32, 2, 4.5f);
      71    VDUP(vector2, q, float, f, 32, 4, 5.6f);
      72  
      73    TEST_BINARY_OP(INSN_NAME, , float, f, 32, 2);
      74    TEST_BINARY_OP(INSN_NAME, q, float, f, 32, 4);
      75  
      76    CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected_float32, "");
      77    CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected_float32, "");
      78  
      79  #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
      80    DECL_VARIABLE(vector, float, 16, 4);
      81    DECL_VARIABLE(vector, float, 16, 8);
      82  
      83    DECL_VARIABLE(vector2, float, 16, 4);
      84    DECL_VARIABLE(vector2, float, 16, 8);
      85  
      86    DECL_VARIABLE(vector_res, float, 16, 4);
      87    DECL_VARIABLE(vector_res, float, 16, 8);
      88  
      89    VDUP(vector, , float, f, 16, 4, 2.3f);
      90    VDUP(vector, q, float, f, 16, 8, 3.4f);
      91  
      92    VDUP(vector2, , float, f, 16, 4, 4.5f);
      93    VDUP(vector2, q, float, f, 16, 8, 5.6f);
      94  
      95    TEST_BINARY_OP(INSN_NAME, , float, f, 16, 4);
      96    TEST_BINARY_OP(INSN_NAME, q, float, f, 16, 8);
      97  
      98    CHECK_FP(TEST_MSG, float, 16, 4, PRIx16, expected_float16, "");
      99    CHECK_FP(TEST_MSG, float, 16, 8, PRIx16, expected_float16, "");
     100  #endif
     101  }