This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Avoid `bit_cast` when printing f32 and f64 immediates
ClosedPublic

Authored by sunfish on Feb 25 2021, 11:17 AM.

Details

Summary

Use APInt to convert a 32-bit or 64-bit immediate to an APFloat rather than bit_cast to a float or double to avoid going through host floating-point and potentially changing the bit pattern of NaNs.

Diff Detail

Event Timeline

sunfish created this revision.Feb 25 2021, 11:17 AM
sunfish requested review of this revision.Feb 25 2021, 11:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2021, 11:17 AM
Herald added a subscriber: aheejin. · View Herald Transcript
sbc100 accepted this revision.Feb 26 2021, 7:26 AM
This revision is now accepted and ready to land.Feb 26 2021, 7:26 AM

I can confirm that this patch fixes the failing immediates.ll test on x86 built by gcc 10.