<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Looking through the documentation, I discovered that atomic loads
and stores are only supported for integer types. Can anyone provide
some background on this? Why is this true?<br>
<br>
Currently, given code:<br>
std::atomic<float> aFloat;<br>
void foo() {<br>
float f = atomic_load(&aFloat);<br>
..<br>
}<br>
<br>
Clang generates code like:<code></code><br>
%"struct.std::atomic.2" = type { float }<br>
@aFloat = global %"struct.std::atomic.2" zeroinitializer, align 4<br>
<br>
define void @foo() {<br>
%1 = load atomic i32* bitcast (%"struct.std::atomic.2"* @aFloat to
i32*) seq_cst, align 4<br>
%2 = bitcast i32 %1 to float<br>
...<br>
}<br>
<br>
This seems less than ideal. I would expect that we might have to
desugar floats into integer & cast operations in the backend,
but why is this imposed on the frontend? <br>
<br>
More generally, is there anyone who is knowledgeable and/or working
on atomics and synchronization in LLVM? I've got a number of
questions w.r.t. semantics and have found a number of what I believe
to be missed optimizations. I'm happy to file the later, but I'd
like to talk them over with a knowledgeable party first.<br>
<br>
Philip<br>
</body>
</html>