vec_cmpnrg: Vector Compare Not in Ranges
d = vec_cmpnrg(a, b, c)
Check
if each element of a is not within any of the ranges
specified by b and c. Each even-odd
element pairs of b define values for the limits of
the ranges. The corresponding even-odd pairs of elements in c control
how the comparison to be performed, in the following way:
Comparison | for vector unsigned char | for vector unsigned short | for vector unsigned int |
---|---|---|---|
ignore - result of comparison always TRUE | 0 | 0 | 0 |
equal | 0x80 | 0x8000 | 0x80000000 |
not equal | 0x60 | 0x6000 | 0x60000000 |
greater than | 0x20 | 0x2000 | 0x20000000 |
greater than or equal | 0xA0 | 0xA000 | 0xA0000000 |
less than | 0x40 | 0x4000 | 0x40000000 |
less than and equal | 0xC0 | 0xC000 | 0xC0000000 |
force to FALSE | 0xE0 | 0xE000 | 0xE0000000 |
For each element of the result, the value of each bit is 1 if the corresponding element of a was not contained in any of the specified ranges. Otherwise, the value of each bit is 0.
d | a | b | c |
---|---|---|---|
vector bool char | vector unsigned char | vector unsigned char | vector unsigned char |
vector bool short | vector unsigned short | vector unsigned short | vector unsigned short |
vector bool int | vector unsigned int | vector unsigned int | vector unsigned int |
Example 1: Comparing 2 ranges
vector unsigned int a = {11, 22, 33, 44};
vector unsigned int b = {10, 20, 30, 40};
vector unsigned int c = {0x20000000, 0x40000000, 0x20000000,
0x40000000}; // {GT, LT, GT, LT}
vector bool int d = vec_cmpnrg(a, b, c);
// d = {0, 0xFFFFFFFF, 0, 0xFFFFFFFF}
In this example, each element of a is
checked to be (> 10 AND < 20) OR (> 30 AND < 40).Example
2: Comparing a single range, and a specific value
vector unsigned int a = {11, 22, 33, 30};
vector unsigned int b = {10, 20, 30, 30};
vector unsigned int c = {0x20000000, 0x40000000, 0x80000000,
0x80000000}; // {GT, LT, EQ, EQ}
vector bool int d = vec_cmpnrg(a, b, c);
// d = {0, 0xFFFFFFFF, 0xFFFFFFFF, 0)
In this example, each element of a is
checked to be (> 10 AND < 20) OR equals to 30.Example 3:
Comparing a single range
vector unsigned int a = {11, 22, 33, 44};
vector unsigned int b = {10, 20, 30, 40};
vector unsigned int c = {0x20000000, 0x40000000, 0x00000000,
0x00000000}; // {GT, LT, X, X}
vector bool int d = vec_cmpnrg(a, b, c);
// d = {0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}
In
this example, each element of a is checked to be
(> 10 AND < 20) only.