pto.por

pto.por is part of the Predicate Generation And Algebra instruction set.

Summary

Bitwise OR of two predicates.

Mechanism

pto.por computes the bitwise OR of two predicate registers, producing a new predicate where lane i is active iff at least one source lane i is active.

\[ \mathrm{dst}_i = \mathrm{src0}_i \lor \mathrm{src1}_i \]

Syntax

PTO Assembly Form

%dst = pto.por %src0, %src1, %mask : !pto.mask<G>, !pto.mask<G>, !pto.mask<G> -> !pto.mask<G>

AS Level 1 (SSA)

%dst = pto.por %src0, %src1, %mask : !pto.mask<G>, !pto.mask<G>, !pto.mask<G> -> !pto.mask<G>

AS Level 2 (DPS)

pto.por ins(%src0, %src1, %mask : !pto.mask<G>, !pto.mask<G>, !pto.mask<G>) outs(%dst : !pto.mask<G>)

C++ Intrinsic

vector_bool dst;
vector_bool src0;
vector_bool src1;
vector_bool mask;
por(dst, src0, src1, mask);

Inputs

Operand Type Description
%src0 !pto.mask<G> First source predicate
%src1 !pto.mask<G> Second source predicate
%mask !pto.mask<G> Optional masking predicate

Expected Outputs

Result Type Description
%dst !pto.mask<G> Bitwise OR of src0 and src1

Side Effects

None.

Constraints

Constraints

  • Operand widths: All predicate operands MUST have the same width.

Exceptions

Exceptions

  • Illegal if predicate operand widths are not consistent.

Target-Profile Restrictions

Target-Profile Restrictions
Aspect CPU Sim A2/A3 A5
Bitwise OR Simulated Supported Supported

Examples

Combine predicates from two conditions

#include <pto/pto-inst.hpp>
using namespace pto;

void union_masks(RegBuf<predicate_t>& dst,
                 const RegBuf<predicate_t>& mask_a,
                 const RegBuf<predicate_t>& mask_b) {
    POR(dst, mask_a, mask_b, mask_a);
}

SSA form — union of two predicates

// %mask_a: lanes where a[i] < threshold_a
// %mask_b: lanes where b[i] > threshold_b

// Union: lanes satisfying either condition
%combined = pto.por %mask_a, %mask_b, %mask_a : !pto.mask<G>, !pto.mask<G>, !pto.mask<G> -> !pto.mask<G>

// Reconstruct full-width predicate from two halves
%lo_combined = pto.por %mask_a_lo, %mask_b_lo, %mask_a_lo : !pto.mask<G>, !pto.mask<G>, !pto.mask<G> -> !pto.mask<G>
%hi_combined = pto.por %mask_a_hi, %mask_b_hi, %mask_a_hi : !pto.mask<G>, !pto.mask<G>, !pto.mask<G> -> !pto.mask<G>