This is an archive of the discontinued LLVM Phabricator instance.

[X86] Enable constexpr on _cast fp<-> uint intrinsics (PR31446)
ClosedPublic

Authored by RKSimon on Aug 22 2020, 7:30 AM.

Details

Summary

As suggested by @rsmith on PR47267, by replacing the builtin_memcpy bitcast pattern with builtin_bit_cast we can use _castf32_u32, _castu32_f32, _castf64_u64 and _castu64_f64 inside constant expresssions (constexpr). Although __builtin_bit_cast was added for c++20 it works on all clang c/c++ modes.

Diff Detail

Event Timeline

RKSimon created this revision.Aug 22 2020, 7:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 22 2020, 7:30 AM
RKSimon requested review of this revision.Aug 22 2020, 7:30 AM
This revision is now accepted and ready to land.Aug 22 2020, 4:07 PM
rsmith accepted this revision.Aug 22 2020, 4:44 PM

It would be useful to include in our documentation a brief list of which of these intrinsics can be used in constant expressions.

This revision was landed with ongoing or failed builds.Aug 23 2020, 2:34 AM
This revision was automatically updated to reflect the committed changes.