Skip to content

[AArch64][FMV] Enable tests for ACLE FMV on Linux. #98

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

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 4 additions & 5 deletions SingleSource/UnitTests/AArch64/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(TARGET_OS STREQUAL "Linux")
list(APPEND CFLAGS --rtlib=compiler-rt)
list(APPEND LDFLAGS --rtlib=compiler-rt)
endif()
if(ARCH STREQUAL "AArch64")
set(Source )
# TODO: this test is currently only supported on Darwin platforms:
if (TARGET_OS MATCHES "Darwin")
list(APPEND Source acle-fmv-features.c)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it get added to Sources automatically for all platforms now?

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 think so looking into

add_subdirectory(AArch64)

But I tested that on aarch64/x86 Linux only

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, seems fine. If we have trouble with non-posix systems (Fuchsia? Windows?) I guess those can be opted out if the buildbots complain.

llvm_singlesource(PREFIX "aarch64-")
endif()
endif()
10 changes: 9 additions & 1 deletion SingleSource/UnitTests/AArch64/acle-fmv-features.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,15 @@ CHECK(ssbs2, {
CHECK(bti, {
// The only test for this requires reading a register that is only
// accessible to EL1.
#if defined(__APPLE__)
#ifdef __linux__
// On linux, the kernel intercepts the trap, and emulates it for EL0 processes.
int val = 0;
asm volatile("mrs %0, ID_AA64PFR1_EL1" : "=r"(val));
// ID_AA64PFR1_EL1.BT, bits [3:0] = 0b0001 if Branch Target Identification
// mechanism implemented.
if ((val & 0xF) != 0x1)
return false;
#elif defined(__APPLE__)
// On Apple platforms, we need to check a sysctl.
int32_t val = 0;
size_t size = sizeof(val);
Expand Down