Intel® C++ Compiler 16.0 User and Reference Guide

omp declare simd

Creates a version of a function that can process multiple arguments using Single Instruction Multiple Data (SIMD) instructions from a single invocation from a SIMD loop.

Syntax

#pragma omp declare simd [clause][[,]clause] ...]

function definition or declaration

Arguments

clause

Can be any of the following:

  • aligned( list[:linear-step] )

  • inbranch

  • simdlen( length )

  • linear( list[:linear-step] )

  • notinbranch

  • processor (cpuid) (an Intel® language extension)

  • reduction( operator:list )

  • uniform( argument-list )

Description

The declare_simd construct enables the creation of SIMD versions of a specific function. These versions can be used to process multiple arguments from a single invocation from a SIMD loop concurrently.

When the function is called, the function must not have any side-effects that would change its execution for concurrent iterations of a SIMD chunk. When the function is called from a SIMD loop, the function cannot cause the execution of any OpenMP* construct.

Example: Generating a version of the min function that will be executed using SIMD instructions

#pragma omp declare simd notinbranch
float min (float a, float b) { Return a < b ? a : b; }

void minner (float *a, float *b, float *c) {
  #pragma omp parallel for simd
  for (i=0; i<N; i++)
  c[i] = min(a[i], b[i], c[i]);
}

See Also