[clang] [llvm] [X86] Replace X86 specific PDEP/PEXT handling with generic intrinsics (PR #204144)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 07:52:31 PDT 2026


================
@@ -6930,6 +6930,20 @@ Value *llvm::simplifyBinaryIntrinsic(Intrinsic::ID IID, Type *ReturnType,
       return Constant::getNullValue(ReturnType);
     break;
   }
+  case Intrinsic::pdep: {
+    if (match(Op1, m_Zero()))
+      return Constant::getNullValue(ReturnType);
+    if (match(Op1, m_AllOnes()))
+      return Op0;
+    break;
+  }
+  case Intrinsic::pext: {
+    if (match(Op1, m_Zero()))
----------------
topperc wrote:

Can we also fold to 0 if the Op0 is 0?

https://github.com/llvm/llvm-project/pull/204144


More information about the cfe-commits mailing list