- Can be any of the following:
- Wherenis a vector length (VL). It must be an integer that is a power of 2; the value must be 2, 4, 8, or 16. If you specify more than onen, the vectorizor will choose the VL from the values specified.Causes each iteration in the vector loop to execute the computation equivalent toniterations of scalar loop execution. Multiplevectorlengthclauses are merged as a union.
- vectorlengthfor(data type)
- Wheredata typemust be one of built-in integer types (8-, 16-, 32-, or 64-bit), pointer types (treated as pointer-sized integer), floating point types (32- or 64-bit), or complex types (64- or 128-bit). Otherwise, behavior is undefined.Causes each iteration in the vector loop to execute the computation equivalent toniterations of scalar loop execution wherenis computed fromsize_of_vector_register/sizeof(.data type)For example,vectorlengthfor(float)results inn=4for Intel® Streaming SIMD Extensions (Intel® SSE2) to Intel SSE4.2 targets (packed float operations available on 128bit XMM registers) andn=8for an Intel® Advanced Vector Extensions (Intel® AVX) target (packed float operations available on 256bit YMM registers).vectorlengthfor(int)results inn=4for Intel SSE2 to Intel AVX targets.vectorlength()andvectorlengthfor()clauses are mutually exclusive. In other words, thevectorlengthfor()clause may not be used with thevectorlength()clause, and vice versa.Behavior for multiplevectorlengthforclauses is undefined.
- Wherevaris a scalar variable.Causes each variable to be private to each iteration of a loop. Unless the variable appears infirstprivateclause, the initial value of the variable for the particular iteration is undefined. Unless the variable appears inlastprivateclause, the value of the variable upon exit of the loop is undefined. Multipleprivateclauses are merged as a union.Execution of the SIMD loop withfirtsprivate/lastprivateclauses may be different from serial execution of the same code even if the loop fails to vectorize.A variable in aprivateclause cannot appear in alinear,reduction,firstprivate, orlastprivateclause.
- Provides a superset of the functionality provided by theprivateclause. Variables that appear in afirstprivatelist are subject toprivateclause semantics. In addition, its initial value is broadcast to all private instances for each iteration upon entering the SIMD loop.A variable in afirstprivateclause can appear in alastprivateclause.A variable in afirstprivateclause cannot appear in alinear,reduction, orprivateclause.
- Provides a superset of the functionality provided by theprivateclause. Variables that appear in alastprivatelist are subject toprivateclause semantics. In addition, when the SIMD loop is exited, each variable has the value that resulted from the sequentially last iteration of the SIMD loop (which may be undefined if the last iteration does not assign to the variable).A variable in alastprivateclause can appear in afirstprivateclause.A variable in alastprivateclause cannot appear in alinear,reduction, orprivateclause.
- Wherevaris a scalar variable andstepis a compile-time positive, integer constant expression.For each iteration of a scalar loop,var1is incremented bystep1,var2is incremented bystep2, and so on. Therefore, every iteration of the vector loop increments the variables by VL*step1, VL*step2, …, to VL*stepN, respectively. If more than one step is specified for avar, a compile-time error occurs. Multiple linear clauses are merged as a union.A variable in alinearclause cannot appear in areduction,private,firstprivate, orlastprivateclause.
- Whereoperis a reduction operator andvaris a scalar variable.Applies the vector reduction indicated byopertovar1,var2, …,varN. Thesimdpragma may have multiple reduction clauses with the same or different operators. If more than one reduction operator is associated with avar, a compile-time error occurs.A variable in areductionclause cannot appear in alinear,private,firstprivate, orlastprivateclause.
- Directs the compiler to assert or not to assert when the vectorization fails. The default isnoassert. If this clause is specified more than once, a compile-time error occurs.
- Instructs the compiler to vectorize or not to vectorize the remainder loop when the original loop is vectorized. See the description of the vector pragma for more information.
- The countable loop for thesimdpragma has to conform to the for-loop style of an OpenMPworksharing loop construct. Additionally, the loop control variable must be a signed integer type.
- The vector values must be signed 8-, 16-, 32-, or 64-bit integers, single or double-precision floating point numbers, or single or double-precision complex numbers.
- A SIMD loop may contain another loop (for,while,do-while) in it. Goto out of such inner loops are not supported. Break and continue are supported.Inlining can create such an inner loop, which may not be obvious at the source level.
- A SIMD loop performs memory references unconditionally. Therefore, all address computations must result in valid memory addresses, even though such locations may not be accessed if the loop is executed sequentially.
Example: Using the