[llvm] r286033 - [AVX-512] Use an equality compare instead of StringRef::startswith in a few places in auto upgrade that were looking for the complete intrinsic name anyway.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 22:35:23 PDT 2016


Author: ctopper
Date: Sat Nov  5 00:35:23 2016
New Revision: 286033

URL: http://llvm.org/viewvc/llvm-project?rev=286033&view=rev
Log:
[AVX-512] Use an equality compare instead of StringRef::startswith in a few places in auto upgrade that were looking for the complete intrinsic name anyway.

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=286033&r1=286032&r2=286033&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/IR/AutoUpgrade.cpp Sat Nov  5 00:35:23 2016
@@ -279,22 +279,22 @@ static bool UpgradeIntrinsicFunction1(Fu
          Name.startswith("avx512.mask.padd.") ||
          Name.startswith("avx512.mask.psub.") ||
          Name.startswith("avx512.mask.pmull.") ||
-         Name.startswith("avx512.mask.add.pd.128") ||
-         Name.startswith("avx512.mask.add.pd.256") ||
-         Name.startswith("avx512.mask.add.ps.128") ||
-         Name.startswith("avx512.mask.add.ps.256") ||
-         Name.startswith("avx512.mask.div.pd.128") ||
-         Name.startswith("avx512.mask.div.pd.256") ||
-         Name.startswith("avx512.mask.div.ps.128") ||
-         Name.startswith("avx512.mask.div.ps.256") ||
-         Name.startswith("avx512.mask.mul.pd.128") ||
-         Name.startswith("avx512.mask.mul.pd.256") ||
-         Name.startswith("avx512.mask.mul.ps.128") ||
-         Name.startswith("avx512.mask.mul.ps.256") ||
-         Name.startswith("avx512.mask.sub.pd.128") ||
-         Name.startswith("avx512.mask.sub.pd.256") ||
-         Name.startswith("avx512.mask.sub.ps.128") ||
-         Name.startswith("avx512.mask.sub.ps.256") ||
+         Name == "avx512.mask.add.pd.128" ||
+         Name == "avx512.mask.add.pd.256" ||
+         Name == "avx512.mask.add.ps.128" ||
+         Name == "avx512.mask.add.ps.256" ||
+         Name == "avx512.mask.div.pd.128" ||
+         Name == "avx512.mask.div.pd.256" ||
+         Name == "avx512.mask.div.ps.128" ||
+         Name == "avx512.mask.div.ps.256" ||
+         Name == "avx512.mask.mul.pd.128" ||
+         Name == "avx512.mask.mul.pd.256" ||
+         Name == "avx512.mask.mul.ps.128" ||
+         Name == "avx512.mask.mul.ps.256" ||
+         Name == "avx512.mask.sub.pd.128" ||
+         Name == "avx512.mask.sub.pd.256" ||
+         Name == "avx512.mask.sub.ps.128" ||
+         Name == "avx512.mask.sub.ps.256" ||
          Name.startswith("sse41.pmovsx") ||
          Name.startswith("sse41.pmovzx") ||
          Name.startswith("avx2.pmovsx") ||
@@ -1298,31 +1298,28 @@ void llvm::UpgradeIntrinsicCall(CallInst
       Rep = Builder.CreateMul(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx512.mask.add.pd.128") ||
-                         Name.startswith("avx512.mask.add.pd.256") ||
-                         Name.startswith("avx512.mask.add.ps.128") ||
-                         Name.startswith("avx512.mask.add.ps.256"))) {
+    } else if (IsX86 && (Name.startswith("avx512.mask.add.p"))) {
       Rep = Builder.CreateFAdd(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx512.mask.div.pd.128") ||
-                         Name.startswith("avx512.mask.div.pd.256") ||
-                         Name.startswith("avx512.mask.div.ps.128") ||
-                         Name.startswith("avx512.mask.div.ps.256"))) {
+    } 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")) {
       Rep = Builder.CreateFDiv(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx512.mask.mul.pd.128") ||
-                         Name.startswith("avx512.mask.mul.pd.256") ||
-                         Name.startswith("avx512.mask.mul.ps.128") ||
-                         Name.startswith("avx512.mask.mul.ps.256"))) {
+    } 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")) {
       Rep = Builder.CreateFMul(CI->getArgOperand(0), CI->getArgOperand(1));
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && (Name.startswith("avx512.mask.sub.pd.128") ||
-                         Name.startswith("avx512.mask.sub.pd.256") ||
-                         Name.startswith("avx512.mask.sub.ps.128") ||
-                         Name.startswith("avx512.mask.sub.ps.256"))) {
+    } 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")) {
       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