Skip to content

[FMV][AArch64] Set HAS_*_FMV macro and skip test if symbol is unavailable #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions SingleSource/Benchmarks/Misc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,29 @@ PROGRAMS_TO_SKIP := dt
endif
endif

ifeq ($(ARCH),AArch64)
ifeq ($(TARGET_OS),Darwin)
SYMBOL = __init_cpu_features_resolver
endif
ifeq ($(TARGET_OS),Linux)
SYMBOL = __init_cpu_features
endif
# TARGET_LLVMGCC refers to the compiler specified with the --cc option,
# and can be checked in the build-tools.log file in the test results directory.
SYMBOL := $(shell echo "extern void $(SYMBOL)(void); void (*p)() = $(SYMBOL); int main() {}" | \
$(TARGET_LLVMGCC) --rtlib=compiler-rt -x c - -o /dev/null 2>/dev/null && \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TARGET_LLVMGCC refers to the compiler specified with the --cc option, and can be checked in the build-tools.log file in the test results directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the build/CMakeFiles/CMakeConfigureLog.yaml to trace how check_symbol_exists is executed through CMakeLists.txt.
compiler-rt (a runtime library) is not shown in the configuration log, but including it in the current patch appears to work fine without introducing any issues.
Here is check_symbol_exists Log :

buildResult:
      variable: "HAS_AARCH64_FMV"
      cached: true
      stdout: |
        Change Dir: /Users/nshc-yjlee_m/Documents/dev/llvm-test-suite/build/CMakeFiles/CMakeScratch/TryCompile-j5irsv
        
        Run Build Command(s):/opt/homebrew/bin/ninja -v cmTC_f539e && [1/2] /Applications/Xcode161_Testing.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc   -arch arm64 -isysroot /Applications/Xcode161_Testing.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk -MD -MT CMakeFiles/cmTC_f539e.dir/CheckSymbolExists.c.o -MF CMakeFiles/cmTC_f539e.dir/CheckSymbolExists.c.o.d -o CMakeFiles/cmTC_f539e.dir/CheckSymbolExists.c.o -c /Users/nshc-yjlee_m/Documents/dev/llvm-test-suite/build/CMakeFiles/CMakeScratch/TryCompile-j5irsv/CheckSymbolExists.c
        [2/2] : && /Applications/Xcode161_Testing.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch arm64 -isysroot /Applications/Xcode161_Testing.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/cmTC_f539e.dir/CheckSymbolExists.c.o -o cmTC_f539e   && :
        
      exitCode: 0

echo $(SYMBOL) || echo undefined)
ifeq ($(SYMBOL),__init_cpu_features_resolver)
CFLAGS += --rtlib=compiler-rt -DHAS_DARWIN_FMV
endif
ifeq ($(SYMBOL),__init_cpu_features)
CFLAGS += --rtlib=compiler-rt -DHAS_LINUX_FMV
endif
ifeq ($(SYMBOL),undefined)
PROGRAMS_TO_SKIP := aarch64-init-cpu-features
endif
endif

ifeq ($(ARCH),Mips)
RUNTIMELIMIT := 2000
endif
Expand Down