_mm_maskz_ternarylogic_epi32ADD TO COMPARE ADDED TO COMPARE
Intel 64-bit (64 bits)/ AVX512
View official documentation
View Félix Cloutier's documentation
Location:
Boolean Logic & Bit Manipulation
>
Boolean Ternary Operations with Zero-Mask
CPU Extensions: AVX512F, AVX512VL
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:
_m128i
Example:
#include <immintrin.h>
#include <stdio.h>
int main() {
__m128i a = _mm_set_epi32(0xFFFFFFFF, 0, 0xFFFFFFFF, 0);
__m128i b = _mm_set1_epi32(0xAAAAAAAA);
__m128i c = _mm_set1_epi32(0x55555555);
__mmask8 k = 0xA;
__m128i result = _mm_maskz_ternarylogic_epi32(k, a, b, c, 0x96);
int* res = (int*)&result;
for (int i = 0; i < 4; i++)
printf("%08X\n", res[i]);
return 0;
}
Prototypes
Assembly Instruction:
VPTERNLOGD
Usage:
_m128i result =
_mm_maskz_ternarylogic_epi32(
__mmask8 a, _m128i b, _m128i c, _m128i 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 |