This is an archive of the discontinued LLVM Phabricator instance.

[test-suite] Add tests for FP classification intrinsics
ClosedPublic

Authored by sepavloff on Jul 26 2021, 9:34 AM.

Event Timeline

sepavloff created this revision.Jul 26 2021, 9:34 AM
sepavloff requested review of this revision.Jul 26 2021, 9:34 AM
Matt added a subscriber: Matt.Aug 6 2021, 3:50 PM

Something I noticed is that we don't have much test coverage in clang/test/codegen for the fpclass intrinsics - including no constexpr testing afaict (although I don't think __builtin_fpclassify is constexpr yet) - is that something you'd be willing to take a look at?

SingleSource/UnitTests/Float/classify.cpp
89

are asserts the best way to do this? most other unit tests print out something to help isolate diffs

Updated patch

  • Moved tests into header files. It should facilitate writing tests for various modes (strict exceptions, fast math etc),
  • Added Makefile,
  • Enhanced diagnostics if test fails,
  • Avoid C++, it makes easier to run test on simulator if there are fewer dependencies.

Something I noticed is that we don't have much test coverage in clang/test/codegen for the fpclass intrinsics - including no constexpr testing afaict (although I don't think __builtin_fpclassify is constexpr yet) - is that something you'd be willing to take a look at?

They present and are in clang/test/Sema/constant-builtins-2.c. This is C file but the constant evaluator is the same for C++. The tested functions are fpclassify, isinf, isnan, isfinite and isnormal. And yes, fpclassify is constexpr.

I've no objections to this - it seems to be orthogonal to the isnan ir intrinsic conversation.

Do we have test-suite buildbot coverage on anything other than x86? Cross platform uses of long double is always fun........

Any other comments?

Do we have test-suite buildbot coverage on anything other than x86? Cross platform uses of long double is always fun........

The following build bots have a stage named test-suite:

clang-ppc64be-linux-lnt
clang-ppc64le-linux-lnt
clang-s390x-linux-lnt
clang-armv7-lnt
clang-native-arm-lnt-perf
clang-aarch64-full-2stage
clang-armv7-vfpv3-full-2stage
clang-thumbv7-full-2stage
clang-cmake-x86_64-avx2-linux-perf
clang-cmake-x86_64-avx2-linux

So it looks like major targets are represented in testing.

If nobody objects, I would commit this change, as it would be useful in the forthcoming return of llvm.isnan.

RKSimon accepted this revision.Sep 16 2021, 6:05 AM

LGTM

This revision is now accepted and ready to land.Sep 16 2021, 6:05 AM
This revision was automatically updated to reflect the committed changes.