<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/69146>69146</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `__builtin_assume_aligned` not taken into account for `__int128` `__sync*` diagnostics
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            backend:SystemZ
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tbaederr
      </td>
    </tr>
</table>

<pre>
    Consider:
```c
static inline void
atomic16_set(__int128 *ptr, __int128 val)
{
 __int128_t *ptr_align = __builtin_assume_aligned(ptr, 16);
    __int128_t old;

    __sync_bool_compare_and_swap_16(ptr_align, old, 0);
}
```

On s390, this causes a warning from codegen, because `ptr_align` is not "naturally aligned".

This was introduced in https://reviews.llvm.org/D143813.
Is the correct alignment for 128bit integers 8 byte or 16 byte on s390? Is the `__builtin_assume_aligned` being propagated and considered for the diagnostic or not?

See also: https://gitlab.com/qemu-project/qemu/-/issues/1934

CC @JonPsson @efriedma-quic 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU8uO4zYQ_Brq0hiDD1mWDjp4bQhILgmwOeUi8NEjM0uRXpIaw38f0NZ6hQmCBQSIzSar2F3VMiU7ecSe7L-Q_bmSS76E2Gcl0WCMlQrm3p-CT9ZgJOJI6JnQI2no89PPOGWZrQbrnfUIH8Ga577MYbaaNWPCTHg7jtZnxlsg_HjNkfATvLY-pCO8W-EPX56LV3rM651ROjt5IOIM46gW67L1o0xpmfGZQkN4u4KzpkCKH2AAW7zgzCu1PZDuXo8qBDfqMF9lxFF6M6abvI4Fr309ojAUEH4CuuUhh_OnLm1J_vCQREfLrXyxCbRcEiaQcJPRWz_Bewwz6GBwwgeFwscRIA39Sd1QsAl8KG3hXuYlSufu8OoA3205_ypEN5nA-hyDWTQasB4uOV9T0ZQPhA8RPyze0s65j3kX4kT4cGa1aJlYsX5LkC8IOsSIOj-5ZvQZ3kMExltlcyHACWOCFtQ9I5RMsy7XwsUAKxJp6P9q2FBQWNpxjeEqJ5nRgPQG9GpFNA_aAmOsnHxIxYAhlp4QMWyr_4oI0qVAxPFTyZPNTqqdDjPhw3ecl7drDP-gzmtI-PBG-GBTWjARPrBO1Fvk0wlITX8P_s-Ugi9rfI8WzSzfvi9WQ2V6YTrRyQp71nSHWtTiUFeXXjEljKIH7Pacdkw0yBgapHWt2o7XqrI9p1wwyhq6F7xudk0J3yllvGs7oUXhmqV1L7mqxyv7pmN1Uzmp0KXHTHOunfQT4ZzwE-FcSf0NvSHi-PWeMs5_l8z-XMW-IL2pZUqkps6m_NMKVbbZYf8LvYobs_yGvrgggNQ6LKs7Hjefk1dOPsIyZ4SXIdkomKoluv4_Kl2WHyqVJ62_jVgvhR7l_xsAAP__vOCBpw">