参考Fortran Array Data and Arguments and Vectorization (intel.com)中示例代码
[Fortran] 纯文本查看 复制代码 subroutine explicit2(A, B, C)
real, intent(in), dimension(400,500) :: A
real, intent(out), dimension(500) :: B
real, intent(inout), dimension(400) :: C
!dir$ assume_aligned A(1,1):64
!dir$ assume_aligned B(1):64
!dir$ assume_aligned C(1):64
!...loop 1
do i=1,500
B(i) = A(3,i)
end do
!...loop 2
do i=1,400
C(i) = C(i) + A(i, 400)
end do
end
其中有!dir$ assume_aligned看起来是设置变量的对齐,但是我将这个去掉后,生成的汇编代码没有任何变化, 详见 https://godbolt.org/z/dG6ndqcK7, 这个有什么问题?
|