Page MenuHomePhabricator

Stop traping on sNaN in __builtin_isinf
Needs ReviewPublic

Authored by thopre on Sat, Feb 20, 2:17 PM.

Details

Summary

__builtin_isinf currently generates a floating-point compare operation
which triggers a trap when faced with a signaling NaN in StrictFP mode.
This commit uses integer operations instead to not generate any trap in
such a case.

Diff Detail

Unit TestsFailed

TimeTest
940 msx64 windows > MLIR.Examples/Toy/Ch6::jit.toy
Script: -- : 'RUN: at line 1'; toyc-ch6 -emit=jit C:\ws\w1\llvm-project\premerge-checks\mlir\test\Examples\Toy\Ch6\jit.toy
4,900 msx64 windows > MLIR.Examples/Toy/Ch7::jit.toy
Script: -- : 'RUN: at line 1'; toyc-ch7 -emit=jit C:\ws\w1\llvm-project\premerge-checks\mlir\test\Examples\Toy\Ch7\jit.toy

Event Timeline

thopre created this revision.Sat, Feb 20, 2:17 PM
thopre requested review of this revision.Sat, Feb 20, 2:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptSat, Feb 20, 2:17 PM
kpn added a comment.Mon, Feb 22, 7:30 AM

System/Z's TEST DATA CLASS instruction covers most (all?) of the possible FP value states. You might want to subscribe, or add as a reviewer, jonpa just to make sure everyone stays in sync.

I think we should also add tests for half

jonpa added a comment.Mon, Feb 22, 9:51 AM
In D97125#2578853, @kpn wrote:

System/Z's TEST DATA CLASS instruction covers most (all?) of the possible FP value states. You might want to subscribe, or add as a reviewer, jonpa just to make sure everyone stays in sync.

Thanks for keeping me updated on this - I see that you have already included the testFPKind() hook, so I will add these opcodes to SystemZ once this is committed...

thopre updated this revision to Diff 325718.Tue, Feb 23, 2:11 AM
  • Add half testcase
  • Fixup existing testcase
thopre added inline comments.Tue, Feb 23, 2:13 AM
clang/test/CodeGen/builtin_float_strictfp.c
21

Am I right to think that clang should not use llvm.convert here since it's a constrained operation? Any idea why that happens?