Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Sep 2022 12:03:03 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Christian Weisgerber <naddy@mips.inka.de>
Cc:        Jan Beich <jbeich@freebsd.org>, freebsd-current@freebsd.org
Subject:   Re: Did clang 14 lose some intrinsics support?
Message-ID:  <430A830E-3473-4EF4-9605-039F8254999C@FreeBSD.org>
In-Reply-To: <YzDKQsfciGd%2BJBQ5@lorvorc.mips.inka.de>
References:  <YzCL/%2BUEhLy7kHaL@lorvorc.mips.inka.de> <zgen-6zwv-wny@FreeBSD.org> <1A903FD8-D904-4B91-ABC4-2F704F0E2CF4@FreeBSD.org> <YzDKQsfciGd%2BJBQ5@lorvorc.mips.inka.de>

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

--Apple-Mail=_8AB4E2B0-A601-47B5-A484-B6BF430ABC73
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

On 25 Sep 2022, at 23:38, Christian Weisgerber <naddy@mips.inka.de> wrote:
> 
> Dimitry Andric:
> 
>>> 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.
> 
> __AVX__, for instance, is not defined unless you compile with -mavx,
> which also allows the compiler to issue AVX instructions during
> normal code generation.

Sure, but if you are compiling without -mavx, why would you want the AVX
intrinsics? You cannot use AVX intrinsics anyway, if AVX is not enabled.

So I don't fully understand the problem this configure scripting is
supposed to solve?

In my opinion, if you would want to know whether the compiler supports
AVX in any mode, you would first attempt to run "$CC -mavx" and if that
succeeds, run a test case which checks for the __AVX__ define. If both
succeed, then AVX intrinsics work, otherwise they don't. Rinse and
repeat for any other particular extension you would want to check. And
should work for both clang and gcc.

-Dimitry


--Apple-Mail=_8AB4E2B0-A601-47B5-A484-B6BF430ABC73
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

iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCYzF41wAKCRCwXqMKLiCW
o3MJAJ92D3yV4DrEbi0462z69A8A5OdjtwCgjm2hJohnFzfsjYb/SlcYQ/nHIpU=
=mwlY
-----END PGP SIGNATURE-----

--Apple-Mail=_8AB4E2B0-A601-47B5-A484-B6BF430ABC73--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?430A830E-3473-4EF4-9605-039F8254999C>