[PATCH] D11866: transform fmin/fmax calls when possible (PR24314)
    Sanjay Patel via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sat Aug 15 05:39:39 PDT 2015
    
    
  
spatel added a comment.
In http://reviews.llvm.org/D11866#219873, @jmolloy wrote:
> This will be important when my latest patches finally land and x86 uses the new ISD::FMINNAN nodes (which represent the semantics of minss precisely).
It doesn't affect this patch, but unfortunately, I don't think x86 can use the new DAG nodes. The x86 min/max insts don't conform to either DAG node definition. The hardware instructions may or may not return a NaN operand. From the Intel manual:
  MAX(SRC1, SRC2)
  {
     IF ((SRC1 = 0.0) and (SRC2 = 0.0)) THEN DEST <- SRC2;
     ELSE IF (SRC1 = SNaN) THEN DEST <- SRC2; FI; 
     ELSE IF SRC2 = SNaN) THEN DEST <- SRC2; FI; 
     ELSE IF (SRC1 > SRC2) THEN DEST <- SRC1; 
     ELSE DEST <- SRC2;
     FI;
   }
The precise behavior of these instructions is tested quite thoroughly in:
test/CodeGen/X86/sse-minmax.ll
http://reviews.llvm.org/D11866
    
    
More information about the llvm-commits
mailing list