1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# This file and its contents are supplied under the terms of the 5# Common Development and Distribution License ("CDDL"), version 1.0. 6# You may only use this file in accordance with the terms of version 7# 1.0 of the CDDL. 8# 9# A full copy of the text of the CDDL should have accompanied this 10# source. A copy of the CDDL is also available via the Internet at 11# https://opensource.org/license/CDDL-1.0. 12# 13 14# 15# Copyright (c) 2022 by Attila Fülöp <attila@fueloep.org> 16# 17 18. $STF_SUITE/include/libtest.shlib 19 20# 21# DESCRIPTION: 22# Make sure we have SIMD support, so it will not go away without notice 23# 24# STRATEGY: 25# 1. Test if we are running on a Linux x86 system with SSE support 26# 2. If so, check if the zfs_fletcher_4_impl module parameter contains 27# a sse implementation 28# 3. If not fail the test, otherwise pass it 29 30log_note "Testing if we support SIMD instructions (Linux x86 only)" 31 32if ! is_linux; then 33 log_unsupported "Not a Linux System" 34fi 35 36case "$(uname -m)" in 37i?86|x86_64) 38 typeset -R modparam="/sys/module/zfs/parameters/zfs_fletcher_4_impl" 39 if awk '/^flags/ {exit !/sse/}' /proc/cpuinfo; then 40 log_must grep -q sse "$modparam" 41 log_pass "SIMD instructions supported" 42 else 43 log_unsupported "No FPU present" 44 fi 45 ;; 46*) 47 log_unsupported "Not a x86 CPU" 48 ;; 49esac 50