Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F175301808
D28395.id83033.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D28395.id83033.diff
View Options
Index: tests/sys/kern/libkern_crc32.c
===================================================================
--- tests/sys/kern/libkern_crc32.c
+++ tests/sys/kern/libkern_crc32.c
@@ -37,6 +37,31 @@
#error These tests are not supported on this platform
#endif
+#if defined(__amd64__) || defined(__i386__)
+#include <machine/cpufunc.h>
+#include <machine/specialreg.h>
+
+static void
+skip_test_if_cpu_features_missing(void)
+{
+
+ u_int cpu_registers[4], ecx;
+
+ do_cpuid(1, cpu_registers);
+
+ ecx = cpu_registers[2];
+
+ if ((ecx & CPUID2_SSE42) == 0) {
+ atf_tc_skip("SSE4.2 not supported.");
+ }
+}
+#else
+static void
+skip_test_if_cpu_features_missing(void)
+{
+}
+#endif
+
ATF_TC_WITHOUT_HEAD(crc32c_basic_correctness);
ATF_TC_BODY(crc32c_basic_correctness, tc)
{
@@ -81,6 +106,8 @@
ATF_REQUIRE(nitems(inputs) == nitems(results));
+ skip_test_if_cpu_features_missing();
+
for (i = 0; i < nitems(inputs); i++) {
#if defined(__amd64__) || defined(__i386__)
act = sse42_crc32c(~0, (const void *)&inputs[i],
@@ -104,6 +131,8 @@
size_t i;
uint32_t act;
+ skip_test_if_cpu_features_missing();
+
for (i = 1; i < 8; i++) {
memcpy(&buf[i], &input, sizeof(input));
@@ -129,6 +158,8 @@
const uint32_t result = 0xec638d62;
uint32_t act;
+ skip_test_if_cpu_features_missing();
+
#if defined(__amd64__) || defined(__i386__)
act = sse42_crc32c(~0, input, sizeof(input));
#else
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 10, 7:19 PM (12 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40565046
Default Alt Text
D28395.id83033.diff (1 KB)
Attached To
Mode
D28395: tests/sys/kern/crc32: Check for SSE4.2 before using it
Attached
Detach File
Event Timeline
Log In to Comment