[libc-commits] [libc] [libc][math][c23] Add remaining linux/* entrypoints for {, u}fromfp{, x}* (PR #86692)

via libc-commits libc-commits at lists.llvm.org
Wed Mar 27 14:45:09 PDT 2024


overmighty wrote:

I think the test failure on 32-bit Arm is caused by this line: https://github.com/llvm/llvm-project/blob/b282259711af7b295cb80a12880bcd8e0d1fcefa/libc/src/__support/FPUtil/NearestIntegerOperations.h#L269

All 3 shifts in that function are wrong no matter the target arch, really. The test just unluckily doesn't catch this mistake on x86-64, AArch64 and RV64, because they all only use the lower 5 bits of the shift amount operand when shifting a 32-bit int, so they shift by 0 instead of 32, so the result is still 1 and not 0. ARMv7's "LSL (register)" instruction uses the lower 8 bits of the shift amount operand, so it gets caught there.

I guess I should change the code to use `FPBits::set_biased_exponent`.

https://github.com/llvm/llvm-project/pull/86692


More information about the libc-commits mailing list