Skip to content

Commit

Permalink
fin aligned
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate committed Dec 27, 2021
1 parent 9c94455 commit 3940bba
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 04/4_simd/07_vectorize_0_to_n_mod4/.vim_localrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
" vim: ft=vim
nnoremap <silent> <F7> :wa<CR>:!make\|\|(echo -n .;read -n1)<CR><CR>
6 changes: 6 additions & 0 deletions 04/4_simd/07_vectorize_0_to_n_mod4/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void func(int *a, int n) {
n = n / 4 * 4;
for (int i = 0; i < n; i++) {
a[i] = i;
}
}
4 changes: 4 additions & 0 deletions 04/4_simd/07_vectorize_0_to_n_mod4/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set -e

gcc -O3 -fomit-frame-pointer -fverbose-asm -S main.cpp -o /tmp/main.S
vim /tmp/main.S
2 changes: 2 additions & 0 deletions 04/4_simd/08_vectorize_0_to_n_mod4_aligned/.vim_localrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
" vim: ft=vim
nnoremap <silent> <F7> :wa<CR>:!make\|\|(echo -n .;read -n1)<CR><CR>
7 changes: 7 additions & 0 deletions 04/4_simd/08_vectorize_0_to_n_mod4_aligned/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
void func(int *a, int n) {
n = n / 4 * 4;
a = (int *)__builtin_assume_aligned(a, 16);
for (int i = 0; i < n; i++) {
a[i] = i;
}
}
4 changes: 4 additions & 0 deletions 04/4_simd/08_vectorize_0_to_n_mod4_aligned/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set -e

gcc -O3 -fomit-frame-pointer -fverbose-asm -S main.cpp -o /tmp/main.S
vim /tmp/main.S
Binary file modified 04/slides.pptx
Binary file not shown.

0 comments on commit 3940bba

Please sign in to comment.