gpt4 book ai didi

linux - 在 Linux 下以 x64/AMD64 模式使用 x87-FPU

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:31:10 26 4
gpt4 key购买 nike

有谁知道 Linux 是否支持在 64 位模式下使用 x87-FPU,即如果指令未被捕获并且寄存器保存在上下文切换中。我不想使用它,而且我知道 SSE 是 x64 模式下的标准;这只是出于好奇。

最佳答案

是的。它是受支持的。 D 语言使用该功能。当您使用类型 floatdouble 时,它会编译 SSE 代码,当您使用 real 时,它告诉编译器使用实现最精确的类型。在 x86 的情况下,它是具有 80 位类型的 x87。

https://godbolt.org/z/50kr-H

real square(real num) {
return num * num;
}

float square(float num) {
return num * num;
}

编译为

real example.square(real):
push rbp
mov rbp, rsp
fld tbyte ptr [rbp + 16]
fstp tbyte ptr [rbp - 16]
fld tbyte ptr [rbp - 16]
fmul st(0), st
pop rbp
ret

float example.square(float):
push rbp
mov rbp, rsp
movss dword ptr [rbp - 4], xmm0
movss xmm0, dword ptr [rbp - 4]
mulss xmm0, dword ptr [rbp - 4]
pop rbp
ret

关于linux - 在 Linux 下以 x64/AMD64 模式使用 x87-FPU,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58481130/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com