Skip to content

Commit c51de09

Browse files
committed
[NFC] Testcase for Issue #1413
A reproducible testcase for issue #1413 is added. The testcase checks if AVX512 pgmath functions are generated only when avx512 target options are specified.
1 parent 8e65ce5 commit c51de09

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

test/f90_correct/inc/pgmath_avx512.mk

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
7+
$(TEST): run
8+
9+
EXTFLAGS=-O3 -march=x86-64 -mtune=core-avx2 -mfma -mavx -mavx2 -mllvm -force-vector-width=16
10+
11+
build: $(SRC)/$(TEST).f90
12+
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
13+
@echo ------------------------------------ building test $@
14+
-$(CC) -c $(CFLAGS) $(SRC)/check.c -o check.$(OBJX)
15+
-$(FC) -c $(FFLAGS) $(EXTFLAGS) $(LDFLAGS) $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX)
16+
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) check.$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX)
17+
18+
19+
run:
20+
@echo ------------------------------------ executing test $(TEST)
21+
$(TEST).$(EXESUFFIX)
22+
23+
verify: ;
24+

test/f90_correct/lit/pgmath_avx512.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
# Shared lit script for each tests. Run bash commands that run tests with make.
7+
8+
# REQUIRES: x86_64-host
9+
# RUN: env KEEP_FILES=%keep FLAGS=%flags TEST_SRC=%/s MAKE_FILE_DIR=%/S/.. bash %/S/runmake | tee %/t
10+
# RUN: cat %t | FileCheck %S/runmake
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
!
2+
! Part of the LLVM Project, under the Apache License v2.0 with LLVM
3+
! Exceptions.
4+
! See https://llvm.org/LICENSE.txt for license information.
5+
! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
!
7+
! Test for USE statement when there is rename of user-defined operator in the
8+
! ONLY option.
9+
! REQUIRES: x86_64-registered-target
10+
11+
program main
12+
real (kind=8) :: a(128), b(128), c(128)
13+
integer :: res,expect
14+
res=1
15+
expect=2
16+
do i=1,100
17+
c(i) = log(a(i)) + log(b(i))
18+
enddo
19+
call sub1(a,b,c,128,res)
20+
call check(res,expect,1);
21+
22+
contains
23+
24+
subroutine sub1(a,b,c,N,res)
25+
real(kind=8), intent(in) :: a(:), b(:)
26+
real(kind=8), intent (out) :: c(:)
27+
integer, intent(IN) :: N
28+
integer, intent(OUT) :: res
29+
30+
do i=1,N,16
31+
c(i) = exp(log(a(i))) + dlog(b(i))
32+
enddo
33+
res=2
34+
end subroutine
35+
36+
end program
37+

0 commit comments

Comments
 (0)