Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i386][Float128][compiler-rt] compiler-rt lack of __subtf3 symbol #121757

Open
zhangtianhao6 opened this issue Jan 6, 2025 · 4 comments
Open

Comments

@zhangtianhao6
Copy link

zhangtianhao6 commented Jan 6, 2025

The __subtf3 function is automatically generated by the subtraction compiler of the float 128 type. However, the compiler rt library of the i386 architecture does not provide the __subtf3 function. The libgcc provides the __subtf3 function. Why does this difference exist? Can we make up for it or do not allow the compiler to automatically generate the __subtf3 function?

case

#include <iostream>

int main() {
    // 创建两个 __float128 类型的变量
    __float128 a = 1.23456789012345678901234567890123456789Q;  // 精度较高
    __float128 b = 0.12345678901234567890123456789012345678Q;

    // 执行减法,编译器将自动使用 __subtf3
    __float128 result = a - b;

    return 0;
}

use compiler-rt error: -rtlib=compiler-rt -m32
use libgcc ok: -m32
https://godbolt.org/z/3YT3PbPEW

@zhangtianhao6
Copy link
Author

cc @phoebewang
how about add ${GENERIC_TF_SOURCES} to i386_SOURCES in compiler-rt/lib/builtins/CMakeLists.txt

@hstk30-hw
Copy link
Contributor

CC @topperc @pranavk @compnerd

@phoebewang
Copy link
Contributor

cc @phoebewang how about add ${GENERIC_TF_SOURCES} to i386_SOURCES in compiler-rt/lib/builtins/CMakeLists.txt

I don't see any reason why not. Maybe create a patch for it?

@compnerd
Copy link
Member

compnerd commented Jan 10, 2025

AFAIK, x86 does not support fp128 which is why it is not present. Windows, Darwin, and FreeBSD (unlike Linux) do not support FP80 which is possible with the x87 co-processor. But, it does make sense to match libgcc as the library is supposed to be ABI compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants