5 ms·
On x86-64, compilers use SIMD instructions and registers to implement floating point math, they just use the single lane instructions. E.g. (https://godbolt.org
by xoranth 2y ago
On x86-64, compilers use SIMD instructions and registers to implement floating point math, they just use the single lane instructions. E.g. (https://godbolt.org/z/94b3r8dMn https://godbolt.org/z/94b3r8dMn):
float my_func(float lhs, float rhs) {
return 2.0f * lhs - 3.0f * rhs;
}
Becomes:
my_func(float, float):
addss xmm0, xmm0
mulss xmm1, DWORD PTR .LC0[rip]
subss xmm0, xmm1
ret
(addss, mulss and subss are SSE2 instructions.)