Skip to content

Instantly share code, notes, and snippets.

Created September 29, 2013 23:52
What would you like to do?
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment