1  /* Arm BF16 instrinsics include file.
       2  
       3     Copyright (C) 2019-2023 Free Software Foundation, Inc.
       4     Contributed by Arm.
       5  
       6     This file is part of GCC.
       7  
       8     GCC is free software; you can redistribute it and/or modify it
       9     under the terms of the GNU General Public License as published
      10     by the Free Software Foundation; either version 3, or (at your
      11     option) any later version.
      12  
      13     GCC is distributed in the hope that it will be useful, but WITHOUT
      14     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
      15     or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
      16     License for more details.
      17  
      18     Under Section 7 of GPL version 3, you are granted additional
      19     permissions described in the GCC Runtime Library Exception, version
      20     3.1, as published by the Free Software Foundation.
      21  
      22     You should have received a copy of the GNU General Public License and
      23     a copy of the GCC Runtime Library Exception along with this program;
      24     see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      25     <http://www.gnu.org/licenses/>.  */
      26  
      27  #ifndef _AARCH64_BF16_H_
      28  #define _AARCH64_BF16_H_
      29  
      30  typedef __bf16 bfloat16_t;
      31  typedef float float32_t;
      32  
      33  #pragma GCC push_options
      34  #pragma GCC target ("+nothing+bf16+nosimd")
      35  
      36  __extension__ extern __inline bfloat16_t
      37  __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
      38  vcvth_bf16_f32 (float32_t __a)
      39  {
      40    return __builtin_aarch64_bfcvtbf (__a);
      41  }
      42  
      43  __extension__ extern __inline float32_t
      44  __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
      45  vcvtah_f32_bf16 (bfloat16_t __a)
      46  {
      47    return __builtin_aarch64_bfcvtsf (__a);
      48  }
      49  
      50  #pragma GCC pop_options
      51  
      52  #endif