[llvm] r286090 - [X86] Use StringRef::startswith to reduce a few compares in the intrinsic autoupgrade code.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 6 16:13:43 PST 2016


Author: ctopper
Date: Sun Nov  6 18:13:42 2016
New Revision: 286090

URL: http://llvm.org/viewvc/llvm-project?rev=286090&view=rev
Log:
[X86] Use StringRef::startswith to reduce a few compares in the intrinsic autoupgrade code.

Modified:
    llvm/trunk/lib/IR/AutoUpgrade.cpp

Modified: llvm/trunk/lib/IR/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AutoUpgrade.cpp?rev=286090&r1=286089&r2=286090&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/IR/AutoUpgrade.cpp Sun Nov  6 18:13:42 2016
@@ -1357,24 +1357,15 @@ void llvm::UpgradeIntrinsicCall(CallInst
       Rep = Builder.CreateFAdd(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name == "avx512.mask.div.pd.128" ||
-                         Name == "avx512.mask.div.pd.256" ||
-                         Name == "avx512.mask.div.ps.128" ||
-                         Name == "avx512.mask.div.ps.256")) {
+    } else if (IsX86 && Name.startswith("avx512.mask.div.p")) {
       Rep = Builder.CreateFDiv(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name == "avx512.mask.mul.pd.128" ||
-                         Name == "avx512.mask.mul.pd.256" ||
-                         Name == "avx512.mask.mul.ps.128" ||
-                         Name == "avx512.mask.mul.ps.256")) {
+    } else if (IsX86 && Name.startswith("avx512.mask.mul.p")) {
       Rep = Builder.CreateFMul(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name == "avx512.mask.sub.pd.128" ||
-                         Name == "avx512.mask.sub.pd.256" ||
-                         Name == "avx512.mask.sub.ps.128" ||
-                         Name == "avx512.mask.sub.ps.256")) {
+    } else if (IsX86 && Name.startswith("avx512.mask.sub.p")) {
       Rep = Builder.CreateFSub(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));




More information about the llvm-commits mailing list