forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MLIR][Flang][OpenMP] Implement lowering simd aligned to MLIR (llvm#9…
…5198) Rebased @DominikAdamski patch: https://reviews.llvm.org/D142722 --------- Co-authored-by: Dominik Adamski <dominik.adamski@amd.com> Co-authored-by: Tom Eccles <t@freedommail.info>
- Loading branch information
1 parent
85e8d62
commit 7ffeaf0
Showing
6 changed files
with
170 additions
and
5 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
! Tests for 2.9.3.1 Simd and target dependent defult alignment for AArch64 | ||
! The default alignment for AARCH64 is 0 so we do not emit aligned clause | ||
! REQUIRES: aarch64-registered-target | ||
! RUN: %flang_fc1 -triple aarch64-unknown-linux-gnu -emit-hlfir -fopenmp %s -o - | FileCheck %s | ||
subroutine simdloop_aligned_cptr(A) | ||
use iso_c_binding | ||
integer :: i | ||
type (c_ptr) :: A | ||
!CHECK: omp.simd | ||
!CHECK-NOT: aligned( | ||
!$OMP SIMD ALIGNED(A) | ||
do i = 1, 10 | ||
call c_test_call(A) | ||
end do | ||
!$OMP END SIMD | ||
end subroutine |
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,48 @@ | ||
! Tests for 2.9.3.1 Simd and target dependent defult alignment for x86 | ||
! REQUIRES: x86-registered-target | ||
! RUN: %flang_fc1 -triple x86_64-unknown-linux-gnu -emit-hlfir -fopenmp -target-cpu x86-64 %s -o - | FileCheck --check-prefixes=DEFAULT %s | ||
! RUN: %flang_fc1 -triple x86_64-unknown-linux-gnu -emit-hlfir -fopenmp -target-cpu x86-64 -target-feature +avx %s -o - | FileCheck --check-prefixes=AVX %s | ||
! RUN: %flang_fc1 -triple x86_64-unknown-linux-gnu -emit-hlfir -fopenmp -target-cpu x86-64 -target-feature +avx512f %s -o - | FileCheck --check-prefixes=AVX512F %s | ||
!DEFAULT: func.func @_QPsimdloop_aligned_cptr(%[[ARG_A:.*]]: !fir.ref | ||
!DEFAULT-SAME: <!fir.type<_QM__fortran_builtinsT__builtin_c_ptr | ||
!DEFAULT-SAME: {__address:i64}>> {fir.bindc_name = "a"}) { | ||
!DEFAULT: %[[A_DECL:.*]]:2 = hlfir.declare %[[ARG_A]] dummy_scope %0 | ||
!DEFAULT-SAME: {uniq_name = "_QFsimdloop_aligned_cptrEa"} : | ||
!DEFAULT-SAME: (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.dscope) -> | ||
!DEFAULT-SAME: (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, | ||
!DEFAULT-SAME: !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) | ||
!AVX: func.func @_QPsimdloop_aligned_cptr(%[[ARG_A:.*]]: !fir.ref | ||
!AVX-SAME: <!fir.type<_QM__fortran_builtinsT__builtin_c_ptr | ||
!AVX-SAME: {__address:i64}>> {fir.bindc_name = "a"}) { | ||
!AVX: %[[A_DECL:.*]]:2 = hlfir.declare %[[ARG_A]] dummy_scope %0 | ||
!AVX-SAME: {uniq_name = "_QFsimdloop_aligned_cptrEa"} : | ||
!AVX-SAME: (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.dscope) -> | ||
!AVX-SAME: (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, | ||
!AVX-SAME: !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) | ||
!AVX512F: func.func @_QPsimdloop_aligned_cptr(%[[ARG_A:.*]]: !fir.ref | ||
!AVX512F-SAME: <!fir.type<_QM__fortran_builtinsT__builtin_c_ptr | ||
!AVX512F-SAME: {__address:i64}>> {fir.bindc_name = "a"}) { | ||
!AVX512F: %[[A_DECL:.*]]:2 = hlfir.declare %[[ARG_A]] dummy_scope %0 | ||
!AVX512F-SAME: {uniq_name = "_QFsimdloop_aligned_cptrEa"} : | ||
!AVX512F-SAME: (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.dscope) -> | ||
!AVX512F-SAME: (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, | ||
!AVX512F-SAME: !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) | ||
subroutine simdloop_aligned_cptr(A) | ||
use iso_c_binding | ||
integer :: i | ||
type (c_ptr) :: A | ||
!DEFAULT: omp.simd aligned(%[[A_DECL]]#1 : !fir.ref | ||
!DEFAULT-SAME: <!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>> | ||
!DEFAULT-SAME: -> 128 : i64) | ||
!AVX: omp.simd aligned(%[[A_DECL]]#1 : !fir.ref | ||
!AVX-SAME: <!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>> | ||
!AVX-SAME: -> 256 : i64) | ||
!AVX512F: omp.simd aligned(%[[A_DECL]]#1 : !fir.ref | ||
!AVX512F-SAME: <!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>> | ||
!AVX512F-SAME: -> 512 : i64) | ||
!$OMP SIMD ALIGNED(A) | ||
do i = 1, 10 | ||
call c_test_call(A) | ||
end do | ||
!$OMP END SIMD | ||
end subroutine |