It shouldn't promote half to double or any larger precision types for fp classification builtins.
Because fp classification builtins would get incorrect result with promoted argument.
For example, __builtin_isnormal with a subnormal half value should return false, but it is not.
That the subnormal half value is promoted to a normal double value.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thank you for the patch -- can you add some test cases?
clang/lib/Sema/SemaChecking.cpp | ||
---|---|---|
5849–5850 | I think this should be combined with the code above. Something like: bool IgnoreCast = false; if (CastArg-> is Float) { assert(stuff); IgnoreCast = true; } else if (CastArg-> is Half) { assert(stuff); IgnoreCast = true; } if (IgnoreCast) { Cast->setSubExpr(nullptr); TheCall->setArg(NumArgs - 1, CastArg); } |
Comment Actions
Thank you for review.
Update patch and add tests that test half value will not be promoted to double.
Comment Actions
This causes build bot failures on SystemZ due to a failed assertion in ConstantFP::getInfinity:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/28723/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Abuiltins.c
Comment Actions
@uweigand
This is fixed by https://reviews.llvm.org/rG9c3966379813c198129c57aa3ebecd68d6af1ebd
Thanks.
I think this should be combined with the code above. Something like: