-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Flang] Add support for assume_aligned directive (#81747)
This adds the parsing (and unparse) of the compiler drective assume_aligned. The compiler will issue a warning that the directive is ignored.
- Loading branch information
1 parent
06bd74b
commit 601a958
Showing
6 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
! RUN: %flang_fc1 -fdebug-unparse-no-sema %s 2>&1 | FileCheck %s | ||
|
||
SUBROUTINE aa(a, nn) | ||
IMPLICIT NONE | ||
INTEGER, INTENT(IN) :: nn | ||
COMPLEX(8), INTENT(INOUT), DIMENSION(1:nn) :: a | ||
INTEGER :: i | ||
!DIR$ assume_aligned a:16 | ||
!CHECK: !DIR$ ASSUME_ALIGNED a:16 | ||
!DIR$ assume_aligned a (1):16 | ||
!CHECK: !DIR$ ASSUME_ALIGNED a(1):16 | ||
!DIR$ assume_aligned a(1):16 | ||
!CHECK: !DIR$ ASSUME_ALIGNED a(1):16 | ||
!DIR$ assume_aligned a(nn):16 | ||
!CHECK: !DIR$ ASSUME_ALIGNED a(nn):16 | ||
!DIR$ assume_aligned a(44):16 | ||
!CHECK: !DIR$ ASSUME_ALIGNED a(44):16 | ||
DO i=1,nn | ||
a(i)=a(i)+1.5 | ||
END DO | ||
END SUBROUTINE aa | ||
|
||
SUBROUTINE bb(v, s, e) | ||
IMPLICIT NONE | ||
INTEGER, INTENT(IN) :: s(3), e(3) | ||
INTEGER :: y,z | ||
REAL(8), INTENT(IN) :: v(s(1):e(1),s(2):e(2),s(3):e(3)) | ||
!DIR$ assume_aligned v(s(1),y,z) :64 | ||
!CHECK: !DIR$ ASSUME_ALIGNED v(s(1),y,z):64 | ||
END SUBROUTINE bb | ||
|
||
SUBROUTINE f(n) | ||
IMPLICIT NONE | ||
TYPE node | ||
REAL(KIND=8), POINTER :: a(:,:) | ||
END TYPE NODE | ||
|
||
TYPE(NODE), POINTER :: nodes | ||
INTEGER :: i | ||
INTEGER, INTENT(IN) :: n | ||
|
||
ALLOCATE(nodes) | ||
ALLOCATE(nodes%a(1000,1000)) | ||
|
||
!DIR$ ASSUME_ALIGNED nodes%a(1,1) : 16 | ||
!CHECK: !DIR$ ASSUME_ALIGNED nodes%a(1,1):16 | ||
DO i=1,n | ||
nodes%a(1,i) = nodes%a(1,i)+1 | ||
END DO | ||
END SUBROUTINE f | ||
|
||
SUBROUTINE g(a, b) | ||
IMPLICIT NONE | ||
INTEGER, INTENT(in) :: a(128), b(128) | ||
!DIR$ ASSUME_ALIGNED a:32, b:64 | ||
!CHECK: !DIR$ ASSUME_ALIGNED a:32, b:64 | ||
END SUBROUTINE g |