-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
f128 symbols on powerpc64 give inaccurate results #125109
Copy link
Copy link
Open
Labels
A-ABIArea: Concerning the application binary interface (ABI)Area: Concerning the application binary interface (ABI)C-bugCategory: This is a bug.Category: This is a bug.F-f16_and_f128`#![feature(f16)]`, `#![feature(f128)]``#![feature(f16)]`, `#![feature(f128)]`O-PowerPCTarget: PowerPC processorsTarget: PowerPC processorsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-ABIArea: Concerning the application binary interface (ABI)Area: Concerning the application binary interface (ABI)C-bugCategory: This is a bug.Category: This is a bug.F-f16_and_f128`#![feature(f16)]`, `#![feature(f128)]``#![feature(f16)]`, `#![feature(f128)]`O-PowerPCTarget: PowerPC processorsTarget: PowerPC processorsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
For some reason, the
__addkf3symbol linked by rustc says that0x00000000000000000000000000000000 + 0x00000000000000000000000000000001 = 0x00000000000000000000000000000000, when the answer should be0x00000000000000000000000000000001. Other symbols likely do the wrong thing here too.Example:
Our Rust code emits
__addkf3which calls the hardware f128 addition routinexsaddup. The part I cannot explain is that the C version also emits__addkf3which also callsxsaddup, but somehow produces a correct result. I checked with GDB to make sure they are both hittingxsaddup, so can't really explain the discrepancy.Original notes at rust-lang/compiler-builtins#606 (comment), discussion on Zulip at https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/f128.20system.20libraries.20noncompliant.20platforms/near/438486364.
Full code copied from rust-lang/compiler-builtins#606 (comment):
Rust code
C code
Assembly generated from Rust (incorrect result)
Assembly generated from C (correct result)