tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types


From: Dmitry Selyutin
Subject: Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple types
Date: Mon, 22 Mar 2021 20:30:29 +0300

> I see.  Those return integer types and hence aren't convertible to struct
> types either (not even with a cast).  This doesn't (and shouldn't)
> compile:
This is because it's not supposed to be called directly. These calls
are _generated_, they're not some kind of manual call.
>From GCC's point of view, they fall into a set of "optimized
routines". From LLVM's, they're generated.
They're simply implementation details.

Calling atomic_load on a single-byte value can lead to __atomic_load_1 routine.
But this routine (which, as it seems, should have its own symbol) is
_not_ an intrinsic.
This is a "generated" call, or "optimized routine" (depending on which
docs to read).

Calling atomic_load on some struct or union which acts as a
single-byte value can lead to __atomic_load_1 routine being invoked.
I don't see a contradiction here. You don't have to match the return
type, this is a generated call, as long as semantics matches, it's OK.
This is not a literal attempt to do `struct compatible_to_type1 comp1
= __atomic_load_1(&atomic)`. This is just about the code generation.

Moreover, this even applies to inline. Implementations can (and will!)
inline the code which corresponds to __atomic_load_1.
I don't know what example you're looking for. What I want is to
implement what's described in the documentation.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]