From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/gcc~13/loop-specific-pragmas.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 devdocs/gcc~13/loop-specific-pragmas.html (limited to 'devdocs/gcc~13/loop-specific-pragmas.html') diff --git a/devdocs/gcc~13/loop-specific-pragmas.html b/devdocs/gcc~13/loop-specific-pragmas.html new file mode 100644 index 00000000..285f8e81 --- /dev/null +++ b/devdocs/gcc~13/loop-specific-pragmas.html @@ -0,0 +1,23 @@ +

6.62.16 Loop-Specific Pragmas

+#pragma GCC ivdep +

With this pragma, the programmer asserts that there are no loop-carried dependencies which would prevent consecutive iterations of the following loop from executing concurrently with SIMD (single instruction multiple data) instructions.

For example, the compiler can only unconditionally vectorize the following loop with the pragma:

void foo (int n, int *a, int *b, int *c)
+{
+  int i, j;
+#pragma GCC ivdep
+  for (i = 0; i < n; ++i)
+    a[i] = b[i] + c[i];
+}
+

In this example, using the restrict qualifier had the same effect. In the following example, that would not be possible. Assume k < -m or k >= m. Only with the pragma, the compiler knows that it can unconditionally vectorize the following loop:

void ignore_vec_dep (int *a, int k, int c, int m)
+{
+#pragma GCC ivdep
+  for (int i = 0; i < m; i++)
+    a[i] = a[i + k] * c;
+}
+
+#pragma GCC unroll n +

You can use this pragma to control how many times a loop should be unrolled. It must be placed immediately before a for, while or do loop or a #pragma GCC ivdep, and applies only to the loop that follows. n is an integer constant expression specifying the unrolling factor. The values of 0 and 1 block any unrolling of the loop.

+

+ © Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
+ https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Loop-Specific-Pragmas.html +

+
-- cgit v1.2.3