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