[llvm] [X86] Break false dependencies of compress/expand on Zen 4 and 5 (#206849) (PR #207079)
Iurii Khosoi via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 1 18:46:24 PDT 2026
================
@@ -0,0 +1,1410 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: llc -verify-machineinstrs -mcpu=znver5 -mattr=+false-deps-compress-expand -mtriple=x86_64-unknown-unknown < %s | FileCheck %s --check-prefixes=ENABLE
+; RUN: llc -verify-machineinstrs -mcpu=znver5 -mattr=-false-deps-compress-expand -mtriple=x86_64-unknown-unknown < %s | FileCheck %s --check-prefixes=DISABLE
+
+; compress
+
+declare <16 x i8> @llvm.x86.avx512.mask.compress.v16i8(<16 x i8>, <16 x i8>, <16 x i1>)
+declare <32 x i8> @llvm.x86.avx512.mask.compress.v32i8(<32 x i8>, <32 x i8>, <32 x i1>)
+declare <64 x i8> @llvm.x86.avx512.mask.compress.v64i8(<64 x i8>, <64 x i8>, <64 x i1>)
+
+define <16 x i8> @compressb_rrz_128(<16 x i8> %a0, i16 %a1) {
+; ENABLE-LABEL: compressb_rrz_128:
+; ENABLE: # %bb.0:
+; ENABLE-NEXT: kmovd %edi, %k1
+; ENABLE-NEXT: vmovdqa %xmm0, %xmm1
+; ENABLE-NEXT: #APP
+; ENABLE-NEXT: #NO_APP
+; ENABLE-NEXT: vxorps %xmm0, %xmm0, %xmm0
+; ENABLE-NEXT: vpcompressb %xmm1, %xmm0 {%k1} {z}
+; ENABLE-NEXT: retq
+;
+; DISABLE-LABEL: compressb_rrz_128:
+; DISABLE: # %bb.0:
+; DISABLE-NEXT: kmovd %edi, %k1
+; DISABLE-NEXT: vmovdqa %xmm0, %xmm1
+; DISABLE-NEXT: #APP
+; DISABLE-NEXT: #NO_APP
+; DISABLE-NEXT: vpcompressb %xmm1, %xmm0 {%k1} {z}
+; DISABLE-NEXT: retq
+ %1 = tail call <2 x i64> asm sideeffect "", "=x,~{xmm0}"()
+ %2 = bitcast i16 %a1 to <16 x i1>
----------------
aadaa-fgtaa wrote:
I'm not sure. The goal is to force different input and output registers so that false dependency isn't hidden by true dependency, and also convince BreakFalseDeps that the output register was written recently so that the dependency is a problem. I suppose it may be better in some sense to have a loop and ensure that the input survives past the instruction, but this would be much more IR/asm code. Should I implement this?
https://github.com/llvm/llvm-project/pull/207079
More information about the llvm-commits
mailing list