Skip to content
Permalink
Browse files

Fix additional test failures on ARM

Due to the complexity of counting specific function calls in either
the assembly file or .ll file, we are now checking -Minfo messages
about whether a specific function is being inlined or not.
  • Loading branch information...
gklimowicz committed Oct 26, 2019
1 parent 1e92c6b commit 40134566207d0ba920ac84b5e96a8a428bc02c34
Showing with 18 additions and 32 deletions.
  1. +8 −23 test/f90_correct/inc/fs11.mk
  2. +10 −9 test/f90_correct/inc/fs12.mk
@@ -18,13 +18,9 @@

# Determine call instruction used
INSN=call
LLFLAG=
OPT=
ifeq ($(findstring aarch64, $(UNAME)), aarch64)
INSN=bl
ifeq ($(findstring O0, $(OPT)), O0)
LLFLAG=-Mkeepll
endif
endif
ifeq ($(findstring ppc64le, $(UNAME)), ppc64le)
INSN=bl
@@ -36,34 +32,23 @@ build: $(SRC)/fs11.f90
-$(RM) fs11.$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
@echo ------------------------------------ building test $@
-$(CC) -c $(CFLAGS) $(SRC)/check.c -o check.$(OBJX)
-$(FC) $(FFLAGS) $(LLFLAG) $(LDFLAGS) $(SRC)/fs11.f90 -S
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/fs11.f90 -o fs11.$(OBJX)
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/fs11.f90 -o fs11.$(OBJX) -Minfo > fs11.txt 2>&1
-$(FC) $(FFLAGS) $(LDFLAGS) fs11.$(OBJX) check.$(OBJX) $(LIBS) -o fs11.$(EXESUFFIX)

# rank2 should not be inlined (except with -Minline=reshape).
# Verify that by checking for exactly 3 calls to mmul.
# This check isn't valid for flang because it allows LLVM to inline.
# Due to the complexity of counting specific function calls in assembly
# or .ll files, we are now checking -Minfo messages about whether rank2 is
# being inlined.
run:
@echo ------------------------------------ executing test fs11
ifeq ($(LLFLAG), -Mkeepll)
@mmul_calls=`grep -c 'void (.*)\*.*mmul' fs11.ll`; \
if [ $$mmul_calls -ne 3 ]; then \
echo "RESULT: FAIL - expected exactly 3 calls to mmul, got $$mmul_calls in fs11.ll" ; \
@mmul_calls=`grep -c 'rank2.*inlined' fs11.txt`; \
if [ $$mmul_calls -ne 0 ]; then \
echo "RESULT: FAIL" ; \
exit 1; \
else \
echo "RESULT: PASS - got exactly 3 calls to mmul in fs11.ll" ; \
fi
else
ifneq ($(FC), flang)
@mmul_calls=`grep -c '$(INSN).*mmul' fs11.s`; \
if [ $$mmul_calls -ne 3 ]; then \
echo "RESULT: FAIL - expected exactly 3 calls to mmul, got $$mmul_calls in fs11.s" ; \
exit 1; \
else \
echo "RESULT: PASS - got exactly 3 calls to mmul in fs11.s" ; \
echo "RESULT: PASS" ; \
fi
endif
endif
fs11.$(EXESUFFIX)

verify: ;
@@ -1,5 +1,5 @@
#
# Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -31,22 +31,23 @@ build: $(SRC)/fs12.f90
-$(RM) fs12.$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
@echo ------------------------------------ building test $@
-$(CC) -c $(CFLAGS) $(SRC)/check.c -o check.$(OBJX)
-$(FC) $(FFLAGS) $(LDFLAGS) $(SRC)/fs12.f90 -S
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/fs12.f90 -o fs12.$(OBJX)
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/fs12.f90 -o fs12.$(OBJX) -Minfo > fs12.txt 2>&1
-$(FC) $(FFLAGS) $(LDFLAGS) fs12.$(OBJX) check.$(OBJX) $(LIBS) -o fs12.$(EXESUFFIX)

# contig_cpy should not be inlined (except with -Minline=reshape).
# Verify that by checking for exactly 3 calls to f90_mcopy.
# This check isn't valid for flang because it allows LLVM to inline.
# Due to the complexity of counting specific function calls in assembly
# or .ll files, we are now checking -Minfo messages about whether rank2 is
# being inlined.
run:
@echo ------------------------------------ executing modified test fs12
ifneq ($(FC), flang)
@mcopy_calls=`grep -ci '$(INSN).*f90_mcopy' fs12.s`; \
if [ $$mcopy_calls -ne 3 ]; then \
echo "RESULT: FAIL - expected exactly 3 calls to f90_mcopy, got $$mcopy_calls" ; \
@mcopy_calls=`grep -ci 'contig_cpy.*inlined' fs12.txt`; \
if [ $$mcopy_calls -ne 0 ]; then \
echo "RESULT: FAIL" ; \
exit 1; \
else \
echo "RESULT: PASS" ; \
fi
endif
fs12.$(EXESUFFIX)

verify: ;

0 comments on commit 4013456

Please sign in to comment.
You can’t perform that action at this time.