Please enter what you're looking for to continue your search
 

_mm256_maskz_ternarylogic_epi32
ADD TO COMPARE ADDED TO COMPARE

 Location: Boolean Logic & Bit Manipulation  >  Boolean Ternary Operations with Zero-Mask
 CPU Extensions: AVX512F, AVX512VL
Purpose:
Bitwise ternary logic that provides the capability to implement any three-operand binary function; the specific binary function is specified by value in "imm8". For each bit in each packed 32-bit integer, the corresponding bit from "a", "b", and "c" are used to form a 3 bit index into "imm8", and the value at that bit in "imm8" is written to the corresponding bit in "dst" using zeromask "k" at 32-bit granularity (32-bit elements are zeroed out when the corresponding mask bit is not set).
Result:

__m256i

Example:
#include <immintrin.h>
#include <stdio.h>
int main() {
 __m256i a = _mm256_set_epi32(0xFFFFFFFF, 0, 0xFFFFFFFF, 0, 0xFFFFFFFF, 0, 0xFFFFFFFF, 0);
 __m256i b = _mm256_set_epi32(0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA);
 __m256i c = _mm256_set_epi32(0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x55555555);
 __mmask8 k = 0xF0;
 __m256i result = _mm256_maskz_ternarylogic_epi32(k, a, b, c, 0x96);
 int* res = (int*)&result;
 for (int i = 0; i < 8; i++)
  printf("%08X\n", res[i]);

  return 0;
 }

Prototypes

Assembly Instruction:
VPTERNLOGD
Usage:
__m256i result = _mm256_maskz_ternarylogic_epi32( __mmask8 a, __m256i b, __m256i c, __m256i d, int e )
Performance Metrics:
📊 Unlock Performance Insights

Get access to detailed performance metrics including latency, throughput, and CPU-specific benchmarks for this intrinsic.

SIMD Intrinsics Summary
SIMD Engines: 6
C Intrinsics: 10444
NEON: 4353
AVX2: 405
AVX512: 4717
SSE4.2: 598
VSX: 192
IBM-Z: 179