Originate from @mattgodbolt's post
Code:
https://godbolt.org/z/_bvrk0
Currently, clang, only static global variable and block local variable is involved for vectorizing.
Why?
My guess is to concurrent code.
Global variables are externed.
Data members are indirected pointed to through *this.
My solution to this is make a local copy of the data member/global value,
after loop/vectorized, copy it back, this will trigger the clang to do vectorization
and produce identical assembly code as gcc.
Code:
https://godbolt.org/z/_bvrk0
Currently, clang, only static global variable and block local variable is involved for vectorizing.
Why?
My guess is to concurrent code.
Global variables are externed.
Data members are indirected pointed to through *this.
My solution to this is make a local copy of the data member/global value,
after loop/vectorized, copy it back, this will trigger the clang to do vectorization
and produce identical assembly code as gcc.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.