This is an archive of the discontinued LLVM Phabricator instance.

[flang] Implement ieee_is_normal
ClosedPublic

Authored by DavidTruby on Feb 28 2023, 7:14 AM.

Details

Summary

This patch adds an implementation of ieee_is_normal using a call
to llvm.is.fpclass.

Depends on D144649

Diff Detail

Event Timeline

DavidTruby created this revision.Feb 28 2023, 7:14 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
DavidTruby requested review of this revision.Feb 28 2023, 7:14 AM
flang/lib/Optimizer/Builder/IntrinsicCall.cpp
3614

Did you miss the zero checks (i.e bits 5 and 6)?

`The result has the value true if IEEE_CLASS (X) has one of the values IEEE_NEGATIVE_-
NORMAL, IEEE_NEGATIVE_ZERO, IEEE_POSITIVE_ZERO or IEEE_POSITIVE_NORMAL; otherwise,
the result has the value false.`

3614

Also is there another way to say the bit positions without having to eye-ball?

flang/test/Lower/Intrinsics/ieee_is_normal.f90
4

kind=2,3 (half precision, bfloat) are also supported.

DavidTruby updated this revision to Diff 501862.Mar 2 2023, 7:31 AM

Add checks for negative and positive zero
Add tests for f16 and bf16

This revision is now accepted and ready to land.Mar 2 2023, 8:04 AM
This revision was automatically updated to reflect the committed changes.