[PATCH] D44909: [InstCombine] (float)((int) f) --> llvm.trunc (PR36617)
    Sanjay Patel via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Mar 26 14:39:29 PDT 2018
    
    
  
spatel created this revision.
spatel added reviewers: scanon, efriedma, craig.topper, RKSimon.
Herald added subscribers: nhaehnle, mcrosier.
fptosi / fptoui round towards zero, and that's the same behavior as llvm.trunc(), so replace a pair of casts with the intrinsic. We don't have to account for special cases (NaN, INF) because out-of-range casts are UB.
For x86, llvm.trunc float/double will be lowered to round** with the appropriate rounding mode.
https://reviews.llvm.org/D44909
Files:
  include/llvm/IR/PatternMatch.h
  lib/Transforms/InstCombine/InstCombineCasts.cpp
  test/CodeGen/AMDGPU/simplify-libcalls.ll
  test/Transforms/InstCombine/sitofp.ll
  test/Transforms/InstCombine/vector-casts.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44909.139853.patch
Type: text/x-patch
Size: 6458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180326/d9db862e/attachment.bin>
    
    
More information about the llvm-commits
mailing list