<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">Currently atomic intrinsics are overloaded by the datatype. That allow us to use a non-suffixed version for any data-type, like this:</div><div class=""><div class=""><font face="Menlo" class=""> signed char sc;</font></div><div class=""><font face="Menlo" class=""> void foo(void) {</font></div><div class=""><font face="Menlo" class=""> (void) __sync_fetch_and_add(&sc, 1);</font></div><div class=""><font face="Menlo" class=""> }</font></div></div><div class="">instead of explicitly specifying data-type, as here:</div><div class=""><div class=""><div class=""><font face="Menlo" class=""> signed char sc;</font></div><div class=""><font face="Menlo" class=""> void foo(void) {</font></div><div class=""><font face="Menlo" class=""> (void) __sync_fetch_and_add_1(&sc, 1);</font></div><div class=""><font face="Menlo" class=""> }</font></div></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class="">For both of these examples clang generates</div><div class=""><font face="Menlo" class=""> %0 = atomicrmw add i8* @sc, i8 1 seq_cst</font></div><div class=""><br class=""></div><div class="">However, it looks like due to this overloading, we completely ignore the size suffix. For instance, for </div><div class=""><div class=""><font face="Menlo" class=""> signed char sc;</font></div><div class=""><font face="Menlo" class=""> void foo(void) {</font></div><div class=""><font face="Menlo" class=""> (void) __sync_fetch_and_add_4(&sc, 1);</font></div><div class=""><font face="Menlo" class=""> }</font></div></div><div class=""><br class=""></div><div class="">clang will generate the same IR with i8:</div><div class=""><div class=""><font face="Menlo" class=""> %0 = atomicrmw add i8* @sc, i8 1 seq_cst ; << i8, instead of i32</font></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Is it an expected behavior, or a bug?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Michael</div></body></html>