This is an archive of the discontinued LLVM Phabricator instance.

AVX-512: Kreg set 0/1 optimization
ClosedPublic

Authored by delena on Dec 22 2015, 11:14 PM.

Details

Summary

The pattern that sets a mask register to all-ones
KXNOR %kn, %kn, %kn
is replaced with
KXNOR %k0, %k0, %kn - KNL optimization.

Diff Detail

Repository
rL LLVM

Event Timeline

delena updated this revision to Diff 43510.Dec 22 2015, 11:14 PM
delena retitled this revision from to AVX-512: Kreg set 0/1 optimization.
delena updated this object.
delena added a reviewer: DavidKreitzer.
delena added a subscriber: llvm-commits.
DavidKreitzer added inline comments.Dec 23 2015, 6:49 AM
../lib/Target/X86/X86InstrInfo.cpp
5287

It would be a good idea to explain why it is preferable to read %k0 here, e.g. "KNL does not recognize dependency-breaking idioms for mask registers, so kxnor %k1, %k1, %k2 has a RAW dependence on %k1. Using %k0 as the undef input register is a performance heuristic based on the assumption that %k0 is used less frequently than the other mask registers, since it is not usable as a write mask. FIXME: A more advanced approach would be to choose the best input mask register based on context."

5426–5428

These SET0 opcodes should also call Expand2AddrKreg with %k0, as KNL doesn't recognize kxor as an idiom either.

delena updated this revision to Diff 43584.Dec 23 2015, 11:55 PM
delena set the repository for this revision to rL LLVM.

Updated according to David's comments.

delena updated this revision to Diff 43585.Dec 24 2015, 12:09 AM

Added comments

This revision was automatically updated to reflect the committed changes.

Thanks, Elena! This looks good.