Rafael EspĂndola
2006-Oct-13 13:29 UTC
[LLVMdev] floating point exceptions in compare instructions
Looking at the llvm code I have the impression that ordered fp comparisons should use exception throwing instructions. Is it true? Thanks, Rafael
Chris Lattner
2006-Oct-13 17:56 UTC
[LLVMdev] floating point exceptions in compare instructions
On Fri, 13 Oct 2006, [UTF-8] Rafael Esp?ndola wrote:> Looking at the llvm code I have the impression that ordered fp > comparisons should use exception throwing instructions. Is it true?Nope, you want non-trapping instructions. If you use trapping instructions, C99 functions like isgreater will not work correctly with NAN's. -Chris -- http://nondot.org/sabre/ http://llvm.org/
Rafael EspĂndola
2006-Oct-13 18:41 UTC
[LLVMdev] floating point exceptions in compare instructions
> Nope, you want non-trapping instructions. If you use trapping > instructions, C99 functions like isgreater will not work correctly with > NAN's.How do I know when to use a trapping instruction? For example consider this C function: ------------------------ int f(float a, float b) { return a <= b; } ------------------------ gcc uses fcmpes instead of fcmps...> -ChrisThanks, Rafael
Possibly Parallel Threads
- [LLVMdev] floating point exceptions in compare instructions
- [LLVMdev] floating point exceptions in compare instructions
- [LLVMdev] More careful treatment of floating point exceptions
- PR43374 - when should comparing NaN values raise a floating point exception?
- [LLVMdev] printing hex format for floating point number