libstdc++: simd Source File

libstdc++

simd
Go to the documentation of this file.
1// Components for element-wise operations on data-parallel objects -*- C++ -*-
2
3// Copyright (C) 2020-2026 Free Software Foundation, Inc.
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
19
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
24
25/** @file experimental/simd
26 * This is a TS C++ Library header.
27 */
28
29//
30// N4773 §9 data-parallel types library
31//
32
33#ifndef _GLIBCXX_EXPERIMENTAL_SIMD
34#define _GLIBCXX_EXPERIMENTAL_SIMD
35
36#include <bits/requires_hosted.h> // experimental is currently omitted
37
38#if __cplusplus >= 201703L
39
40/** @defgroup par-ts Parallelism TS
41 * @ingroup experimental
42 *
43 * Components defined by the _C++ Extensions for Parallelism_
44 * Technical Specification.
45 *
46 * - ISO/IEC TS 19570:2015 C++ Extensions for Parallelism
47 * - ISO/IEC TS 19570:2018 C++ Extensions for Parallelism, Version 2
48 */
49
50/** @defgroup ts_simd Data parallel extensions
51 * @ingroup par-ts
52 *
53 * Data-parallel types library.
54 * @since C++17
55 */
56/// @ingroup ts_simd
57#define __cpp_lib_experimental_parallel_simd 201803
58
59#pragma GCC diagnostic push
60// Many [[gnu::vector_size(N)]] types might lead to a -Wpsabi warning which is
61// irrelevant as those functions never appear on ABI borders
62#ifndef _GLIBCXX_CLANG
63#pragma GCC diagnostic ignored "-Wpsabi"
64#endif
65
66// If __OPTIMIZE__ is not defined some intrinsics are defined as macros, making
67// use of C casts internally. This requires us to disable the warning as it
68// would otherwise yield many false positives.
69#ifndef __OPTIMIZE__
70#pragma GCC diagnostic ignored "-Wold-style-cast"
71#endif
72
73#include "bits/simd_detail.h"
74#include "bits/simd.h"
75#include "bits/simd_fixed_size.h"
76#include "bits/simd_scalar.h"
77#include "bits/simd_builtin.h"
78#include "bits/simd_converter.h"
79#if _GLIBCXX_SIMD_X86INTRIN
80#include "bits/simd_x86.h"
81#elif _GLIBCXX_SIMD_HAVE_NEON
82#include "bits/simd_neon.h"
83#if _GLIBCXX_SIMD_HAVE_SVE
84#include "bits/simd_sve.h"
85#endif
86#elif __ALTIVEC__
87#include "bits/simd_ppc.h"
88#endif
89#include "bits/simd_math.h"
90
91#pragma GCC diagnostic pop
92
93#endif // C++17
94#endif // _GLIBCXX_EXPERIMENTAL_SIMD
95// vim: ft=cpp
requires_hosted.h