Created
September 29, 2013 23:52
-
-
Save jckarter/6757629 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
struct vec4 { | |
float __attribute__((vector_size(16))) elts; | |
}; | |
void putVec4(vec4 *out, const std::vector<float> &v) { | |
*out = {{v[0], v[1], v[2], v[3]}}; | |
} | |
/* | |
$ clang++ -DNDEBUG -O3 -std=c++11 -S ~/foo.cpp | |
__Z7putVec4P4vec4RKSt6vectorIfSaIfEE: ## @_Z7putVec4P4vec4RKSt6vectorIfSaIfEE | |
pushq %rbp | |
movq %rsp, %rbp | |
movq (%rsi), %rax | |
movups (%rax), %xmm0 | |
movaps %xmm0, (%rdi) | |
popq %rbp | |
ret | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment