Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Sep 2022 22:46:47 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Jan Beich <jbeich@FreeBSD.org>
Cc:        Christian Weisgerber <naddy@mips.inka.de>, freebsd-current@freebsd.org
Subject:   Re: Did clang 14 lose some intrinsics support?
Message-ID:  <1A903FD8-D904-4B91-ABC4-2F704F0E2CF4@FreeBSD.org>
In-Reply-To: <zgen-6zwv-wny@FreeBSD.org>
References:  <YzCL/%2BUEhLy7kHaL@lorvorc.mips.inka.de> <zgen-6zwv-wny@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_6A6C5323-8673-47D3-90AB-FAAB7E847848
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

On 25 Sep 2022, at 21:02, Jan Beich <jbeich@FreeBSD.org> wrote:
> 
> Christian Weisgerber <naddy@mips.inka.de> writes:
> 
>> Did we lose support for SSSE3 and AVX2 intrinsics on amd64 with
>> clang 14?
> 
> __builtin_* appear unstable unlike _mm* intrinsics. Clang 15 seems
> to hide more but I'm not sure about the cause (need bisecting).

Yeah, these internal names are constantly changing. I don't know the
reason for it, but it's terribly annoying when diagnosing failures with
preprocessed files, as these tend to break when compiled with a much
earlier or later copy of clang.


> ===> clang version 15.0.1
> #define SSE2_SUPPORTED 1
> #define SSE_SUPPORTED 1
> 
> ===> clang version 15.0.1 with -march=native
> #define AVX_SUPPORTED 1
> #define FMA_SUPPORTED 1
> #define SSE2_SUPPORTED 1
> #define SSE4_1_SUPPORTED 1
> #define SSE_SUPPORTED 1
> 
>> #if __has_builtin(__builtin_ia32_pabsd128)
>>  #define SSSE3_SUPPORTED 1
>> #endif
> [...]
>> #if __has_builtin(__builtin_ia32_pabsd256)
>>  #define AVX2_SUPPORTED 1
>> #endif
> 
> See https://github.com/llvm/llvm-project/commit/e5147f82e1cb
> 
> - Instead of __builtin_ia32_pabsd128 maybe use _mm_abs_epi32
> - Instead of __builtin_ia32_pabsd256 maybe use _mm256_abs_epi32
> 

I'm wondering why this rather fragile method is chosen? If you want to
know whether SSE is supported, you check for __SSE__, and similarly
__SSE2__, __AVX__ and a bunch of others. That is also portable to gcc.

-Dimitry


--Apple-Mail=_6A6C5323-8673-47D3-90AB-FAAB7E847848
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.2

iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCYzC+NwAKCRCwXqMKLiCW
o7zLAJ4+KxyghfjJZriIcC2tPbhcZPQ7eACg8KGwhFatN/7MdCi+EC0cliBs9v8=
=XJ7C
-----END PGP SIGNATURE-----

--Apple-Mail=_6A6C5323-8673-47D3-90AB-FAAB7E847848--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1A903FD8-D904-4B91-ABC4-2F704F0E2CF4>