Skip to content

Commit 458fed3

Browse files
committed
[AArch64][FMV] Enable tests for ACLE FMV on Linux.
Enabling Linux part of llvm#87
1 parent 5148f0b commit 458fed3

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
2+
if(TARGET_OS STREQUAL "Linux")
3+
list(APPEND CFLAGS --rtlib=compiler-rt)
4+
list(APPEND LDFLAGS --rtlib=compiler-rt)
5+
endif()
26
if(ARCH STREQUAL "AArch64")
3-
set(Source )
4-
# TODO: this test is currently only supported on Darwin platforms:
5-
if (TARGET_OS MATCHES "Darwin")
6-
list(APPEND Source acle-fmv-features.c)
7-
endif()
87
llvm_singlesource(PREFIX "aarch64-")
98
endif()
109
endif()

SingleSource/UnitTests/AArch64/acle-fmv-features.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,14 @@ CHECK(ssbs2, {
196196
CHECK(bti, {
197197
// The only test for this requires reading a register that is only
198198
// accessible to EL1.
199-
#if defined(__APPLE__)
199+
#ifdef __linux__
200+
int val = 0;
201+
asm volatile("mrs %0, ID_AA64PFR1_EL1" : "=r"(val));
202+
// ID_AA64PFR1_EL1.BT, bits [3:0] = 0b0001 if Branch Target Identification
203+
// mechanism implemented.
204+
if ((val & 0xF) != 0x1)
205+
return false;
206+
#elif defined(__APPLE__)
200207
// On Apple platforms, we need to check a sysctl.
201208
int32_t val = 0;
202209
size_t size = sizeof(val);

0 commit comments

Comments
 (0)