Reputation: 15
I thought that I do not want to use SSE instructions in libc library functions like strcpy()
.
So I attempted to build from source code with option -mno-sse
.
However, I got an error like the following, I could not make it.
../stdlib/bits/stdlib-float.h: In function ‘atof’:
../stdlib/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
Is there anyone who knows the cause? Is there anyone who can solve it ?
Upvotes: 0
Views: 1358
Reputation: 365157
The x86-64 System V ABI's calling convention returns float
and double
in XMM registers.
SSE2 is baseline for x86-64. 64-bit code can assume it without checking, so the standard calling convention uses it. You never need to disable SSE2 for compatibility with hardware.
To compile without SSE for x86-64, you'll need a compiler that can use an alternate calling convention for floating point, or you'll need to build glibc without any floating point args or return values if that's even possible. (FP code within a function is fine; gcc knows how to fall back to x87 if SSE isn't available, even in 64-bit code.)
Even then, there might not be a hand-written x86-64 asm version of strcpy
without SSE2 in glibc, only for 32-bit x86. So glibc may not compile for that reason even if you did avoid the float
/double
problem. And if it does, the generic C strcpy
will suck for performance compared to SSE2.
It should work fine to build glibc for 32-bit x86 without SSE. The i386 System V ABI's calling convention passes FP args on the stack, and returns them in x87 st0
.
SSE is an optional extension to 32-bit x86; not all 32-bit-only CPUs have it, so toolchains and libraries do need to support being compiled without it.
Upvotes: 2