The NEC LLVM-IR Vectorizer uses the clang as front-end, so non-architectural options and predefined macros of the clang are available. This chapter is specialized for the NEC LLVM-IR Vectorizer.


clang -target ve-linux -fnvec --nvec-path=<directory> [clang options] [llvm-vec options] filename

Example of compiling and linking a C source file.

$ clang -target ve-linux -fnvec a.c

Example of compiling and linking with llvm-vec option (-faggressive-associative-math).

$ clang -target ve-linux -fnvec -faggressive-associative-math a.c


The clang inputs a C/C++ source file, and outputs LLVM-IR source codes for the NEC LLVM-IR Vectorizer.


The following options are added. You can also specify options for the NEC LLVM-IR Vectorizer Command.
-target <value>

Generates code for the given target. Specifies ve-linux as the target when using the NEC LLVM-IR Vectorizer.


Enables the NEC LLVM-IR Vectorizer.


Specifies installation directory for the NEC LLVM-IR Vectorizer.

Predefined Macros

The following predefined macros are added.

__ve, __ve__

Always defined as 1.

Compiler Directives

The following Compiler Directives are supported.

  • [no]advance_gather

  • [no]assume

  • gather_reorder

  • ivdep

  • [no]list_vector

  • [no]lstval

  • move / move_unsafe / nomove

  • nofma

  • [no]packed_vector

  • shortloop

  • [no]sparse

  • [no]vector

  • [no]verror_check

  • [no]vob

  • [no]vovertake

  • [no]vwork

These are placed immediately before a for, while, do-while, or c++11 range-based for loop like #pragma unroll. For details on compiler directives, see C/C++ Compiler User’s Guide in documents.


  • The default optimization level is changed to -O1.

  • Clang for NEC LLVM-IR Vectorizer is Reference Implementation of VE. There is no quality guarantee.