[llvm] [X86][APX] Use TEST instruction for CLOAD/CSTORE (PR #151160)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 17:49:48 PDT 2025


================
@@ -162,7 +162,7 @@ entry:
 define void @load_zext(i1 %cond, ptr %b, ptr %p) {
 ; CHECK-LABEL: load_zext:
 ; CHECK:       # %bb.0: # %entry
-; CHECK-NEXT:    andb $1, %dil
+; CHECK-NEXT:    testb $1, %dil
----------------
phoebewang wrote:

I only see `cmp` <-> `test` conversions. I think `test` is always preferred when only eflags of an `and` is used, hence pattern:
```
def X86testpat : PatFrag<(ops node:$lhs, node:$rhs),
                         (X86cmp (and_su node:$lhs, node:$rhs), 0)>;
```

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


More information about the llvm-commits mailing list