[llvm] [X86] Avoid shl->mul lowbit-isolate fold when BMI1/BMI2 are available (PR #217776)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 09:50:18 PDT 2026
================
@@ -0,0 +1,46 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=x86-64-v2 | FileCheck %s --check-prefix=NOBMI
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=x86-64-v3 | FileCheck %s --check-prefix=BMI
+
+define i32 @mul_unconstrained(i32 %x, i32 %y){
+; NOBMI-LABEL: mul_unconstrained:
+; NOBMI: # %bb.0:
+; NOBMI-NEXT: movl %esi, %eax
+; NOBMI-NEXT: negl %eax
+; NOBMI-NEXT: andl %esi, %eax
+; NOBMI-NEXT: imull %edi, %eax
+; NOBMI-NEXT: retq
+;
+; BMI-LABEL: mul_unconstrained:
+; BMI: # %bb.0:
+; BMI-NEXT: blsil %esi, %eax
----------------
Andarwinux wrote:
Even if this PR can't fix #216550, it's still a useful optimization. Please just update the PR description to indicate this added an optimization for a pattern exposed in #214517, instead of fixes #216550.
https://github.com/llvm/llvm-project/pull/217776
More information about the llvm-commits
mailing list