News for hackers. Stuff that matters.
Re:Zig / C++ Interop by threeducks on Tuesday November 11, 2025 @08:41AM (#45887173)
Yes. For example consider this function to add two 2D points, which accepts and returns all variables entirely in xmm registers: https://gcc.godbolt.org/z/hPGKrh6W4 (surprisingly, gcc generates some fairly odd assembly code here)
Re:Zig / C++ Interop by anematode on Tuesday November 11, 2025 @10:12AM (#45888151)
It's fixed if you pass -fno-trapping-math. There could be junk in the upper half of the registers that causes a floating-point exception.
Re:Zig / C++ Interop by threeducks on Tuesday November 11, 2025 @10:21AM (#45888278)
Oh, that explains the seemingly useless movs. Thank you! I simply thought that it was a bug, since clang did not emit them.