[PATCH] D50714: [InstCombine] Fold Select with binary op - FP opcodes

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 21 07:43:42 PDT 2018


xbolva00 added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:72-73
+    IsEq = true;
+  else if (Pred == FCmpInst::FCMP_ONE)
+    IsEq = false;
+  else
----------------
spatel wrote:
> Did you try testing ONE/UNE in alive-fp?
```
%A = fcmp one float %x, 0.0
%B = fadd nsz float %x, %z
%C = select i1 %A, float %B, float %y
=>
%C = select i1 %A, float %B, float %z
----------                                                                      
  %A = fcmp one float %x, 0.0
  %B = fadd nsz float %x, %z
  %C = select %A, float %B, float %y
=>
  %C = select %A, float %B, float %z

ERROR: Mismatch in values for float %C                                          

Example:
float %x = NaN
   i1 %A = 0x0 (0)
float %z = 0.0640411376953125*(2**-126)
float %B = NaN
float %y = 1.00048828125*(2**1)
source: 1.00048828125*(2**1)
target: 0.0640411376953125*(2**-126)

xbolva00 at xbolva00:~/alive-nj$ ./run.py                               
[Reading from terminal...]
%A = fcmp une float %x, 0.0
%B = fadd nsz float %x, %z
%C = select i1 %A, float %B, float %y
=>
%C = select i1 %A, float %B, float %z
----------                                                                      
  %A = fcmp une float %x, 0.0
  %B = fadd nsz float %x, %z
  %C = select %A, float %B, float %y
=>
  %C = select %A, float %B, float %z

ERROR: Mismatch in values for float %C                                          

Example:
float %x = = +0.0
   i1 %A = 0x0 (0)
float %z = NaN
float %B = NaN
float %y = 0.0000002384185791015625*(2**-126)
source: 0.0000002384185791015625*(2**-126)
target: NaN

```


https://reviews.llvm.org/D50714





More information about the llvm-commits mailing list