From owner-svn-ports-head@freebsd.org Fri Dec 20 10:45:52 2019 Return-Path: Delivered-To: svn-ports-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 699C81D5CF9; Fri, 20 Dec 2019 10:45:52 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47fQQ828rtz3KsH; Fri, 20 Dec 2019 10:45:52 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1354) id 42A7310684; Fri, 20 Dec 2019 10:45:52 +0000 (UTC) From: Jan Beich To: Alexey Dokuchaev Cc: Gleb Popov , svn-ports-head@freebsd.org, svn-ports-all@freebsd.org, ports-committers@freebsd.org Subject: Re: svn commit: r520468 - in head/sysutils: . cpuid2cpuflags References: <201912200518.xBK5IHPq022253@repo.freebsd.org> <20191220084532.GA30042@FreeBSD.org> Date: Fri, 20 Dec 2019 11:45:48 +0100 In-Reply-To: <20191220084532.GA30042@FreeBSD.org> (Alexey Dokuchaev's message of "Fri, 20 Dec 2019 08:45:32 +0000") Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Dec 2019 10:45:52 -0000 Alexey Dokuchaev writes: > On Fri, Dec 20, 2019 at 09:45:49AM +0400, Gleb Popov wrote: > >> On Fri, Dec 20, 2019 at 9:18 AM Alexey Dokuchaev wrote: >> > New Revision: 520468 >> > URL: https://svnweb.freebsd.org/changeset/ports/520468 >> > >> > Log: >> > The program attempts to obtain the identification and capabilities >> > of the currently used CPU, and print the matching set of CPU_FLAGS_* >> > flags for Gentoo Linux, but it could be useful for FreeBSD as well. >> >> I wrote something similar for FreeBSD specifically: sysutils/hs-cputype > > Sure thing, except that it's written in Haskell, so one has to either use > the binary package or download and/or build rather heavy environment to > "make install" it. > > It also reports slightly different (and scarcer) values, e.g. on this AMD > A8-5550M of mine: > > $ cpuid2cpuflags > CPU_FLAGS_X86: aes avx f16c fma3 fma4 mmx mmxext pclmul popcnt > sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 xop > > $ /usr/local/bin/cputype -f > xop avx sse42 sse41 ssse3 sse4a sse3 amd64 sse2 sse mmx > > That said, I think both tools can be useful and have their place in the > ports tree. :)- Neither supports non-x86 architectures[1] on FreeBSD. Even on x86 both are incomplete compared to "cc -march=native -v" e.g., cpuid2cpuflags lacks avx512bf16 while hs-cputype doesn't support avx512 at all. [1] Here're various ways to detect CPU features: aarch64: - READ_SPECIALREG(id_aa64isar0) - elf_aux_info: AT_HWCAP (on FreeBSD 13+) armv6 and armv7: - sysctl(KERN_PROC_AUXV): AT_HWCAP + AT_HWCAP2 - elf_aux_info: AT_HWCAP + AT_HWCAP2 (on FreeBSD 12+) powerpc and powerpc64: - sysctlbyname: kern.cpu_features + kern.cpu_features2 - elf_aux_info: AT_HWCAP + AT_HWCAP2 (on FreeBSD 12+) riscv64: - elf_aux_info: AT_HWCAP (on FreeBSD 13+)