[llvm] [X86] Remove redundant `cmp` before `adc` after `lzcnt` or `tzcnt` (PR #208392)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 22:55:52 PDT 2026


================
@@ -0,0 +1,334 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+bmi,+lzcnt | FileCheck %s --check-prefix=X64
+; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+bmi,+lzcnt | FileCheck %s --check-prefix=X86
+
+define i64 @remove_redundant_cmp_lzcnt_i64(i64 %0) {
+; X64-LABEL: remove_redundant_cmp_lzcnt_i64:
+; X64:       # %bb.0:
+; X64-NEXT:    lzcntq %rdi, %rax
+; X64-NEXT:    adcq $0, %rax
+; X64-NEXT:    retq
+;
+; X86-LABEL: remove_redundant_cmp_lzcnt_i64:
----------------
VachanVY wrote:

@phoebewang  Do you mean take out the i64 tests and put them in a separate file (eg: `remove-redunadant-cmp-lzcnt-tzcnt-i64.ll`) with only 
```llvm
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+bmi,+lzcnt | FileCheck %s --check-prefix=X64
```

cc @RKSimon 

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


More information about the llvm-commits mailing list