Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Aug 2020 18:11:45 +0200
From:      =?UTF-8?B?VMSzbA==?= Coosemans <tijl@FreeBSD.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Gleb Popov <arrowd@freebsd.org>, toolchain@freebsd.org
Subject:   Re: Undefined reference to __atomic_store_8
Message-ID:  <20200812181145.5e5dd7de@FreeBSD.org>
In-Reply-To: <20200812143517.GZ2551@kib.kiev.ua>
References:  <CALH631=FxoEdp_akV-szxTuLVrZ4oFgHWKcWJNOGEuLwqJ3Hyw@mail.gmail.com> <20200808133000.GC2551@kib.kiev.ua> <CALH631nqdHq02xYM4cnOaPhmB5L3O5TJyZiKVNrUJu7kHg0uFQ@mail.gmail.com> <20200809143742.430764e7@FreeBSD.org> <20200809154312.GH2551@kib.kiev.ua> <CALH631=7M6J3L7AzgHqEwtyBo6f-9SPM4w3PDAULUACVwJMVyg@mail.gmail.com> <20200811235210.41049ad1@FreeBSD.org> <CALH631kJhO3LTYqHsd%2Bu0c_KNegQVaphbyhrbtTxGLkLHQ9s3w@mail.gmail.com> <CALH631mVop8dKbe775VdyjSeLA1sKEO-yDdufWa%2BiT2Vi8TEFg@mail.gmail.com> <20200812134158.249dc5ca@FreeBSD.org> <20200812143517.GZ2551@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 12 Aug 2020 17:35:17 +0300 Konstantin Belousov
<kostikbel@gmail.com> wrote:
> On Wed, Aug 12, 2020 at 01:41:58PM +0200, T=C4=B3l Coosemans wrote:
>> StgWord64 is uint64_t which is unsigned long long which is 4 byte
>> aligned on i386.  Clang wants 8 byte alignment to use the fildll
>> instruction. =20
> This all is very strange.
>=20
> How could code use fildll to load 8 bytes as bit-value ?  FILDLL converts
> single and double precision fp into long-double fp, so it would change
> the bit-value.

FILDLL loads long long and converts it to long double which has 64 bit
mantissa so the value is unchanged.

> Also, both ISA and x86 psABI only require 4-byte alignment for the
> double precision fp variables.
>=20
> If the variable memory spans over two cache lines, then SDM states that
> the access can be not atomic, but I believe it cannot happen for any
> existing CPU. It might be slow. For some future CPUs, Intel provides
> control which would cause such accesses to trap.

Well, it seems clang follows the SDM and assumes 8 byte alignment is
needed because then the variable never crosses a cache line boundary.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200812181145.5e5dd7de>