(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
bfloat16_simd_1.c
       1  /* { dg-do assemble { target { aarch64*-*-* } } } */
       2  /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
       3  /* { dg-add-options arm_v8_2a_bf16_neon }  */
       4  /* { dg-additional-options "-O3 --save-temps" } */
       5  /* { dg-final { check-function-bodies "**" "" } } */
       6  
       7  #include <arm_neon.h>
       8  
       9  /*
      10  **stacktest1:
      11  **	sub	sp, sp, #16
      12  **	str	h0, \[sp, 14\]
      13  **	ldr	h0, \[sp, 14\]
      14  **	add	sp, sp, 16
      15  **	ret
      16  */
      17  bfloat16_t stacktest1 (bfloat16_t __a)
      18  {
      19    volatile bfloat16_t b = __a;
      20    return b;
      21  }
      22  
      23  /*
      24  **stacktest2:
      25  **	sub	sp, sp, #16
      26  **	str	d0, \[sp, 8\]
      27  **	ldr	d0, \[sp, 8\]
      28  **	add	sp, sp, 16
      29  **	ret
      30  */
      31  bfloat16x4_t stacktest2 (bfloat16x4_t __a)
      32  {
      33    volatile bfloat16x4_t b = __a;
      34    return b;
      35  }
      36  
      37  /*
      38  **stacktest3:
      39  **	sub	sp, sp, #16
      40  **	str	q0, \[sp\]
      41  **	ldr	q0, \[sp\]
      42  **	add	sp, sp, 16
      43  **	ret
      44  */
      45  bfloat16x8_t stacktest3 (bfloat16x8_t __a)
      46  {
      47    volatile bfloat16x8_t b = __a;
      48    return b;
      49  }
      50  
      51  /*  Test compilation of __attribute__ vectors of 8, 16, 32, etc. BFloats.  */
      52  typedef bfloat16_t v8bf __attribute__((vector_size(16)));
      53  typedef bfloat16_t v16bf __attribute__((vector_size(32)));
      54  typedef bfloat16_t v32bf __attribute__((vector_size(64)));
      55  typedef bfloat16_t v64bf __attribute__((vector_size(128)));
      56  typedef bfloat16_t v128bf __attribute__((vector_size(256)));
      57  
      58  v8bf stacktest4 (v8bf __a)
      59  {
      60    volatile v8bf b = __a;
      61    return b;
      62  }
      63  
      64  v16bf stacktest5 (v16bf __a)
      65  {
      66    volatile v16bf b = __a;
      67    return b;
      68  }
      69  
      70  v32bf stacktest6 (v32bf __a)
      71  {
      72    volatile v32bf b = __a;
      73    return b;
      74  }
      75  
      76  v64bf stacktest7 (v64bf __a)
      77  {
      78    volatile v64bf b = __a;
      79    return b;
      80  }
      81  
      82  v128bf stacktest8 (v128bf __a)
      83  {
      84    volatile v128bf b = __a;
      85    return b;
      86  }
      87  
      88  /* Test use of constant values to assign values to vectors.  */
      89  
      90  typedef bfloat16_t v2bf __attribute__((vector_size(4)));
      91  v2bf c2 (void) { return (v2bf) 0x12345678; }
      92  
      93  bfloat16x4_t c3 (void) { return (bfloat16x4_t) 0x1234567812345678; }