pto.pnot¶
pto.pnot is part of the Predicate Generation And Algebra instruction set.
Summary¶
Bitwise NOT of a predicate.
Mechanism¶
pto.pnot computes the bitwise NOT of a predicate register, producing a new predicate where lane i is active iff the source lane i is inactive.
\[ \mathrm{dst}_i = \neg \mathrm{src}_i \]
Syntax¶
PTO Assembly Form¶
%dst = pto.pnot %src, %mask : !pto.mask<G>, !pto.mask<G> -> !pto.mask<G>
AS Level 1 (SSA)¶
%dst = pto.pnot %src, %mask : !pto.mask<G>, !pto.mask<G> -> !pto.mask<G>
AS Level 2 (DPS)¶
pto.pnot ins(%src, %mask : !pto.mask<G>, !pto.mask<G>) outs(%dst : !pto.mask<G>)
C++ Intrinsic¶
vector_bool dst;
vector_bool src;
vector_bool mask;
pnot(dst, src, mask);
Inputs¶
| Operand | Type | Description |
|---|---|---|
%src |
!pto.mask<G> |
Source predicate to invert |
%mask |
!pto.mask<G> |
Optional masking predicate |
Expected Outputs¶
| Result | Type | Description |
|---|---|---|
%dst |
!pto.mask<G> |
Bitwise NOT of src |
Side Effects¶
None.
Constraints¶
Constraints
- Operand widths: Both predicates MUST have the same width.
- No implicit extension:
pnotoperates on the full predicate width. For predicates of mixed widths, explicit pack/unpack must be used.
Exceptions¶
Exceptions
- Illegal if predicate operand widths are not consistent.
Target-Profile Restrictions¶
Target-Profile Restrictions
| Aspect | CPU Sim | A2/A3 | A5 |
|---|---|---|---|
| Bitwise NOT | Simulated | Supported | Supported |
Examples¶
Invert a predicate¶
#include <pto/pto-inst.hpp>
using namespace pto;
void invert_mask(RegBuf<predicate_t>& dst,
const RegBuf<predicate_t>& src) {
PNOT(dst, src, src);
}
SSA form — complement of comparison result¶
// %cmp: lanes where a[i] < b[i]
%cmp = pto.vcmp %va, %vb, %seed, "lt" : !pto.vreg<64xf32>, !pto.vreg<64xf32>, !pto.mask<b32> -> !pto.mask<b32>
// %tail: lanes in remainder region
%tail = pto.pge_b32 %rem : i32 -> !pto.mask<G>
// Complement: lanes NOT in remainder region
%not_tail = pto.pnot %tail, %tail : !pto.mask<G>, !pto.mask<G> -> !pto.mask<G>
// Combine: lanes in remainder region AND NOT in comparison result
%active = pto.pand %tail, %not_tail, %tail : !pto.mask<G>, !pto.mask<G>, !pto.mask<G> -> !pto.mask<G>
Related Ops / Instruction Set Links¶
- Instruction set overview: Predicate Generation And Algebra
- Previous op in instruction set: pto.pxor
- Next op in instruction set: pto.psel
- Control-shell overview: Control and configuration