[clang] [llvm] [X86][AVX512] rematerialize smaller predicate masks (PR #166178)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 3 19:03:13 PST 2025


================
@@ -3173,6 +3179,23 @@ let Predicates = [HasAVX512] in {
   def : Pat<(v1i1 immAllOnesV),  (COPY_TO_REGCLASS (KSET1W), VK1)>;
 }
 
+// With AVX512DQ, use 8-bit operations for 8-bit masks to avoid setting upper
+// bits
+let Predicates = [HasDQI] in {
+  def : Pat<(v8i1 immAllZerosV), (KSET0B)>;
+  def : Pat<(v8i1 immAllOnesV), (KSET1B)>;
----------------
phoebewang wrote:

Are we selecting to above patterns due to the order?
```
def : Pat<(v8i1 immAllZerosV), (COPY_TO_REGCLASS (KSET0W), VK8)>;
def : Pat<(v8i1 immAllOnesV),  (COPY_TO_REGCLASS (KSET1W), VK8)>;
```

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


More information about the llvm-commits mailing list