Skip to content

Commit 51d6145

Browse files
aartbikcommit-bot@chromium.org
authored andcommitted
[vm/assembler] Skip tests on hosts without POPCNT/LZCNT
Change-Id: I49552c67d908d941eb08ab0a5c49cca4c39148bc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117920 Reviewed-by: Alexander Aprelev <[email protected]> Reviewed-by: Ryan Macnak <[email protected]> Commit-Queue: Aart Bik <[email protected]>
1 parent 27c127d commit 51d6145

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

runtime/vm/compiler/assembler/assembler_ia32_test.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ ASSEMBLER_TEST_GENERATE(Popcnt, assembler) {
366366
}
367367

368368
ASSEMBLER_TEST_RUN(Popcnt, test) {
369+
if (!HostCPUFeatures::popcnt_supported()) {
370+
return;
371+
}
369372
typedef int (*PopcntCode)();
370373
EXPECT_EQ(36, reinterpret_cast<PopcntCode>(test->entry())());
371374
EXPECT_DISASSEMBLY(
@@ -387,6 +390,9 @@ ASSEMBLER_TEST_GENERATE(Lzcnt, assembler) {
387390
}
388391

389392
ASSEMBLER_TEST_RUN(Lzcnt, test) {
393+
if (!HostCPUFeatures::abm_supported()) {
394+
return;
395+
}
390396
typedef int (*LzcntCode)();
391397
EXPECT_EQ(44, reinterpret_cast<LzcntCode>(test->entry())());
392398
EXPECT_DISASSEMBLY(

runtime/vm/compiler/assembler/assembler_x64_test.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#if defined(TARGET_ARCH_X64)
77

88
#include "vm/compiler/assembler/assembler.h"
9+
#include "vm/cpu.h"
910
#include "vm/os.h"
1011
#include "vm/unit_test.h"
1112
#include "vm/virtual_memory.h"
@@ -626,6 +627,12 @@ ASSEMBLER_TEST_GENERATE(Testb2, assembler) {
626627
}
627628

628629
ASSEMBLER_TEST_RUN(Testb2, test) {
630+
// TODO(ajcbik): split out popcount and lzcnt.
631+
if (!HostCPUFeatures::popcnt_supported() ||
632+
!HostCPUFeatures::abm_supported()) {
633+
return;
634+
}
635+
629636
typedef int64_t (*Testb2Code)();
630637
EXPECT_EQ(42, reinterpret_cast<Testb2Code>(test->entry())());
631638
EXPECT_DISASSEMBLY(

0 commit comments

Comments
 (0)