[PATCH] #pragma vectorize

Nadav Rotem nrotem at apple.com
Tue Apr 22 10:49:17 PDT 2014


+
 /// WhileStmt - This represents a 'while' stmt.
 ///
-class WhileStmt : public Stmt {
+class WhileStmt : public Stmt, public LoopVectorizeHints {
   enum { VAR, COND, BODY, END_EXPR };
   Stmt* SubExprs[END_EXPR];
   SourceLocation WhileLoc;

Hi Tyler, 

Maybe we should rename 'LoopVectorizeHints' to 'LoopHints’?   Like Hal said, we would like to implement the 'unroll' pragma and this class is probably the natural place to implement this feature. 

Thanks,
Nadav

On Apr 21, 2014, at 4:23 PM, Tyler Nowicki <tnowicki at apple.com> wrote:

> Hi,
> 
> Please review the attached patch for adding pragma vectorize syntax / vectorization hints to clang.
> 
> pragma vectorize
> * supports the options enable, disable, unroll(_value_), and width(_value_)
> * options are turned into vectorization hints that are used during codegen to add metadata to the conditional branch of the for, while, and do-while loops.
> * enable forces the vectorizer to consider the loop, for example when compiling with Os
> * disable prevents vectorization of the loop
> * The _value_ specified by unroll(_value_) and width(_value_) must be a positive integer. It will be used to set the llvm.vectorizer.unroll or llvm.vectorizer.width metadata values.
> 
> Thank you,
> 
> Tyler Nowicki
> Apple
> 
> <pragma_vectorize-svn.patch>





More information about the cfe-commits mailing list