[cfe-dev] Size suffix ignored in atomic builtins?
Mikhail Zolotukhin via cfe-dev
cfe-dev at lists.llvm.org
Mon Aug 24 12:52:48 PDT 2015
Hi,
Currently atomic intrinsics are overloaded by the datatype. That allow us to use a non-suffixed version for any data-type, like this:
signed char sc;
void foo(void) {
(void) __sync_fetch_and_add(&sc, 1);
}
instead of explicitly specifying data-type, as here:
signed char sc;
void foo(void) {
(void) __sync_fetch_and_add_1(&sc, 1);
}
For both of these examples clang generates
%0 = atomicrmw add i8* @sc, i8 1 seq_cst
However, it looks like due to this overloading, we completely ignore the size suffix. For instance, for
signed char sc;
void foo(void) {
(void) __sync_fetch_and_add_4(&sc, 1);
}
clang will generate the same IR with i8:
%0 = atomicrmw add i8* @sc, i8 1 seq_cst ; << i8, instead of i32
Is it an expected behavior, or a bug?
Thanks,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150824/73969de5/attachment.html>
More information about the cfe-dev
mailing list