[PATCH] D31398: [X86][X86 intrinsics]Folding cmp(sub(a, b), 0) into cmp(a, b) optimization

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 08:58:56 PDT 2017


RKSimon added a reviewer: spatel.
RKSimon added a subscriber: llvm-commits.
RKSimon added a comment.

Please make sure you always include llvm-commits as a subscriber in future patches.



================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:2401
+        // (No NaNs,no inf,no sign zero)
+        if ((I->getFastMathFlags().unsafeAlgebra() ||
+             (I->getFastMathFlags().noNaNs() &&
----------------
Pull out these repeated calls to getFastMathFlags:
```
FastMathFlags FMFs = I->getFastMathFlags();
```


================
Comment at: test/Transforms/InstCombine/X86FsubCmpCombine.ll:1
+ ; RUN: opt < %s -instcombine -S| FileCheck %s
+ 
----------------
Regenerate with utils/update_test_checks.py


================
Comment at: test/Transforms/InstCombine/X86FsubCmpCombine.ll:5
+ 
+define zeroext i16 @fucntionTets(<2 x double> %a, <4 x double> %b, <8 x double> %c, <4 x float> %d, <8 x float> %e, <16 x float> %f,<2 x double> %aa, <4 x double> %bb, <8 x double> %cc, <4 x float> %dd, <8 x float> %ee, <16 x float> %ff) local_unnamed_addr #0 {
+entry:
----------------
maybe split these into one test per intrinsic? also do tests for safe algebra (or maybe one of the other fmfs each per test).


================
Comment at: test/Transforms/InstCombine/X86FsubCmpCombine.ll:12
+  %sub.i43 = fsub fast <8 x float> %e, %ee
+  %sub.i42 = fsub fast <16 x float> %f, %ff
+  ; CHECK:  call i8 @llvm.x86.avx512.mask.cmp.pd.128(<2 x double> %a, <2 x double> %aa, i32 5, i8 -1)
----------------
clean this up if possible


https://reviews.llvm.org/D31398





More information about the llvm-commits mailing list