This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Implement __builtin_isfinite
ClosedPublic

Authored by tbaeder on Jul 15 2023, 9:28 AM.

Diff Detail

Event Timeline

tbaeder created this revision.Jul 15 2023, 9:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 15 2023, 9:28 AM
tbaeder requested review of this revision.Jul 15 2023, 9:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 15 2023, 9:28 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tbaeder updated this revision to Diff 540699.Jul 15 2023, 9:39 AM
aaron.ballman added inline comments.Jul 17 2023, 11:09 AM
clang/lib/AST/Interp/InterpBuiltin.cpp
195

We have platforms on which the width of an integer is not 32-bits; because this is pushing values back onto the stack, won't we run into some odd issues where builtin + 1 would be adding a 32-bit and a 16-bit value?

tbaeder added inline comments.Jul 17 2023, 10:58 PM
clang/lib/AST/Interp/InterpBuiltin.cpp
195

Yes, you don't even need to add anything for it to fail. I can add a way of doing that in a follow-up commit. And/or add an assertion now.

Also, what platform would that be? So I can add a test later.

aaron.ballman accepted this revision.Jul 18 2023, 7:22 AM

LGTM

clang/lib/AST/Interp/InterpBuiltin.cpp
195

AVR and MSP430 both use 16-bit int, I don't know of anyone using 8-bit currently. You can search for IntWidth = to see the choices made by various targets (default is 32-bit though).

This revision is now accepted and ready to land.Jul 18 2023, 7:22 AM
This revision was landed with ongoing or failed builds.Jul 31 2023, 12:13 AM
This revision was automatically updated to reflect the committed changes.