[llvm] [X86] Sink NOT to be fold into ANDN (PR #172329)
Piotr Fusik via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 16 23:48:36 PST 2025
================
@@ -0,0 +1,3168 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=i686-- -mattr=-bmi | FileCheck %s --check-prefixes=X86-NOBMI,X86
+; RUN: llc < %s -mtriple=i686-- -mattr=-bmi,+sse | FileCheck %s --check-prefixes=X86-NOBMI,X86-SSE
+; RUN: llc < %s -mtriple=i686-- -mattr=-bmi,+sse2 | FileCheck %s --check-prefixes=X86-NOBMI,X86-SSE2
+; RUN: llc < %s -mtriple=i686-- -mattr=+bmi | FileCheck %s --check-prefixes=X86-BMI
+; RUN: llc < %s -mtriple=x86_64-- -mattr=-bmi | FileCheck %s --check-prefixes=X64,X64-NOAVX2,X64-NOBMI
+; RUN: llc < %s -mtriple=x86_64-- -mattr=+bmi | FileCheck %s --check-prefixes=X64,X64-BMI,X64-NOAVX2
+; RUN: llc < %s -mtriple=x86_64-- -mattr=+bmi,+avx2 | FileCheck %s --check-prefixes=X64,X64-BMI,X64-AVX2
+
+define i8 @and_sink_not_i8(i8 %x, i8 %m, i1 zeroext %cond) {
+; X86-NOBMI-LABEL: and_sink_not_i8:
+; X86-NOBMI: # %bb.0:
+; X86-NOBMI-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; X86-NOBMI-NEXT: cmpb $0, {{[0-9]+}}(%esp)
+; X86-NOBMI-NEXT: je .LBB0_2
+; X86-NOBMI-NEXT: # %bb.1: # %mask
+; X86-NOBMI-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NOBMI-NEXT: notb %cl
+; X86-NOBMI-NEXT: andb %al, %cl
+; X86-NOBMI-NEXT: movl %ecx, %eax
+; X86-NOBMI-NEXT: .LBB0_2: # %identity
+; X86-NOBMI-NEXT: retl
+;
+; X86-BMI-LABEL: and_sink_not_i8:
+; X86-BMI: # %bb.0:
+; X86-BMI-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; X86-BMI-NEXT: cmpb $0, {{[0-9]+}}(%esp)
+; X86-BMI-NEXT: je .LBB0_2
+; X86-BMI-NEXT: # %bb.1: # %mask
+; X86-BMI-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-BMI-NEXT: notb %cl
+; X86-BMI-NEXT: andb %al, %cl
----------------
pfusik wrote:
I don't know why `andn` is not used for `i8`.
https://github.com/llvm/llvm-project/pull/172329
More information about the llvm-commits
mailing list