https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91841

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Matthias Kretz from comment #0)
> Test case `g++ -O2 -m32` (cf. https://godbolt.org/z/RDUZo9):
> 
> #include <iostream>
> 
> using T = unsigned short;
> using V [[gnu::vector_size(8)]] = T;
> 
> [[gnu::noinline]] V f(V x) { return x; }
> 
> int main() {
>     volatile float a = 1.f;
>     auto x = f(~V{});
>     asm("" :: "X"(x));
>     std::cout << a + 2.f;
> }
> 
> The V parameter is passed via mm0 which leads to 1.f+2.f becoming -nan.
> 
> If GCC cannot reliably insert emms, it should not (never!) transparently
> emit MMX code. Nowhere in this code did I ask for MMX... I understand that
> this would be an ABI break. But at least clang does not implement this ABI
> either.

Clang is wrong here. Please see [1], section 2.2.3, Parameter Passing and
Returning Values.

> Why is this relevant?

Because of [1]. GCC implements published ABI.

[1] https://www.uclibc.org/docs/psABI-i386.pdf

Reply via email to