diff options
| author | Bevin Hansson <59652494+bevin-hansson@users.noreply.github.com> | 2024-03-15 12:42:23 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-15 12:42:23 +0100 | 
| commit | f623adbbbdea8ac6af06e44be218e4fa969e523d (patch) | |
| tree | 52193e847d041d0295ac41fcdfdf26d00c0a42cf /llvm/unittests/ADT/APIntTest.cpp | |
| parent | c7fc95baae8e662506c22511b29e1ad86b910248 (diff) | |
| download | llvm-f623adbbbdea8ac6af06e44be218e4fa969e523d.zip llvm-f623adbbbdea8ac6af06e44be218e4fa969e523d.tar.gz llvm-f623adbbbdea8ac6af06e44be218e4fa969e523d.tar.bz2 | |
[ExpandLargeFpConvert] Fix bug in int-to-fp expansion. (#85370)
When deciding whether to perform rounding on the significand,
the generated IR was using (width - leading zeros - 1) rather
than (width - leading zeros). This is different from how the
routine in compiler-rt does it:
    int sd = srcBits - clzSrcT(a);
    int e = sd - 1;
    if (sd > dstMantDig) {
This bug means that the following code, when built on -O0:
    #include <stdio.h>
    _BitInt(233) v_1037 = 0;
    int main(void)
    {
        v_1037 = 18014398509481982wb;
        double d = v_1037;
        printf("d = %f\n", d);
        return 0;
    }
prints "d = 9007199254740992.000000", which is incorrect.
The correct result is "d = 18014398509481982.000000".
Diffstat (limited to 'llvm/unittests/ADT/APIntTest.cpp')
0 files changed, 0 insertions, 0 deletions
