Skip to content

Commit

Permalink
mdlint
Browse files Browse the repository at this point in the history
  • Loading branch information
kaityo256 committed Oct 17, 2018
1 parent aedd443 commit f53356d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2471,7 +2471,7 @@ g++ -O1 -mavx2 -S func_simd.cpp
LBB0_1:
vmovupd (%rax,%rcx), %ymm0 # (a[i],a[i+1],a[i+2],a[i+3]) -> ymm0
vaddpd (%rax,%rdx), %ymm0, %ymm0 # ymm0 + (b[i],b[i+1],b[i+2],b[i+3]) -> ymm 0
vmovupd %ymm0, (%rax,%rsi) # ymm0 -> (c[i],c[i+1],c[i+2],c[i+3])
vmovupd %ymm0, (%rax,%rsi) # ymm0 -> (c[i],c[i+1],c[i+2],c[i+3])
addq $4, %rdi # i += 4
addq $32, %rax
cmpq $10000, %rdi
Expand Down Expand Up @@ -2523,6 +2523,10 @@ void check(void(*pfunc)(), const char *type) {
}
```
全部まとめたコードはこちら。
[day7/simdcheck.cpp](day7/simdcheck.cpp)
実際に実行してテストしてみよう。
```sh
Expand Down Expand Up @@ -2564,12 +2568,12 @@ LOOP BEGIN at func.cpp(5,3)
remark #15305: vectorization support: vector length 4
remark #15399: vectorization support: unroll factor set to 4
remark #15300: LOOP WAS VECTORIZED
remark #15448: unmasked aligned unit stride loads: 2
remark #15449: unmasked aligned unit stride stores: 1
remark #15448: unmasked aligned unit stride loads: 2
remark #15449: unmasked aligned unit stride stores: 1
remark #15475: --- begin vector loop cost summary ---
remark #15476: scalar loop cost: 6
remark #15477: vector loop cost: 1.250
remark #15478: estimated potential speedup: 4.800
remark #15476: scalar loop cost: 6
remark #15477: vector loop cost: 1.250
remark #15478: estimated potential speedup: 4.800
remark #15488: --- end vector loop cost summary ---
remark #25015: Estimate of max trip count of loop=625
LOOP END
Expand All @@ -2586,7 +2590,7 @@ LOOP END
でも、こういう時にはアセンブリ見ちゃった方が早い。
```sh
$ icpc -march=core-avx2 -O2 -S func.cpp
icpc -march=core-avx2 -O2 -S func.cpp
```
コンパイラが吐いたアセンブリを、少し手で並び替えたものがこちら。
Expand Down

0 comments on commit f53356d

Please sign in to comment.