arm_bf16.h 1.6 KB

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