vec_minADD TO COMPARE ADDED TO COMPARE
IBM Power 9 64-bit (64 bits)/ VSX
View official documentation
Location:
Math Functions
>
Vector Minimum
Purpose:
Purpose: Returns a vector containing the minimum value from each set of corresponding elements of the source vectors.
Result value: The value of each element of output is the minimum of the values of the corresponding elements of a and b.
Endian considerations: None.
Result:
vector double
Prototypes
Assembly Instruction:
xvminsp
Usage:
vector float result =
vec_min(
vector float a, vector float b
)
Performance Metrics:
📊 Unlock Performance Insights
Get access to detailed performance metrics including latency, throughput, and CPU-specific benchmarks for this intrinsic.
Example:
#include <altivec.h>
#include <stdio.h>
vector float a = {
1.5, -2.5, 0.3, 3.7
};
vector float b = {
-0.5, 2.5, 0.2, 4.5
};
vector float result = vec_min(a, b);
printf("Result: [");
for (int i = 0; i < 4; ++i) {
printf("%.2f", ((float*)&result)[i]);
if (i < 3) printf(", ");
}
printf("]\n");
Assembly Instruction:
xvmindp
Usage:
vector double result =
vec_min(
vector double a, vector double b
)
Performance Metrics:
Login required
Example:
#include <altivec.h>
#include <stdio.h>
vector double a = {
1.5, -2.5
};
vector double b = {
-0.5, 2.5
};
vector double result = vec_min(a, b);
printf("Result: [");
for (int i = 0; i < 2; ++i) {
printf("%.2f", ((double*)&result)[i]);
if (i < 1) printf(", ");
}
printf("]\n");
Assembly Instruction:
vminsb
Usage:
vector signed char result =
vec_min(
vector signed char a, vector signed char b
)
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
vector signed char a = {
-50, 60, -30, 90, -10, 80, -20, 100, -40, 70, -50, 90, -30, 100, -20, 80
};
vector signed char b = {
0, 70, -40, 100, -20, 90, -10, 80, -30, 60, -50, 85, -20, 95, -10, 90
};
vector signed char result = vec_min(a, b);
printf("Result: [");
for (int i = 0; i < 16; ++i) {
printf("%d", ((char*)&result)[i]);
if (i < 15) printf(", ");
}
printf("]\n");
return 0;
}
Assembly Instruction:
vminud
Usage:
vector unsigned long long result =
vec_min(
vector unsigned long long a, vector unsigned long long b
)
Example:
#include <altivec.h>
#include <stdio.h>
vector unsigned long long a = {
20ULL, 40ULL
};
vector unsigned long long b = {
25ULL, 45ULL
};
vector unsigned long long result = vec_min(a, b);
printf("Result: [");
for (int i = 0; i < 2; ++i) {
printf("%llu", ((unsigned long long*)&result)[i]);
if (i < 1) printf(", ");
}
printf("]\n");
Assembly Instruction:
vminsd
Usage:
vector signed long long result =
vec_min(
vector signed long long a, vector signed long long b
)
Example:
#include <altivec.h>
#include <stdio.h>
vector signed long long a = {
-10LL, 25LL
};
vector signed long long b = {
5LL, 30LL
};
vector signed long long result = vec_min(a, b);
printf("Result: [");
for (int i = 0; i < 2; ++i) {
printf("%lld", ((long long*)&result)[i]);
if (i < 1) printf(", ");
}
printf("]\n");
Assembly Instruction:
vminuw
Usage:
vector unsigned int result =
vec_min(
vector unsigned int a, vector unsigned int b
)
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
vector unsigned int a = {
20, 40, 35, 50
};
vector unsigned int b = {
25, 45, 30, 55
};
vector unsigned int result = vec_min(a, b);
printf("Result: [");
for (int i = 0; i < 4; ++i) {
printf("%u", ((unsigned int*)&result)[i]);
if (i < 3) printf(", ");
}
printf("]\n");
return 0;
}
Assembly Instruction:
vminsw
Usage:
vector signed int result =
vec_min(
vector signed int a, vector signed int b
)
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
vector signed int a = {
-10, 25, -30, 15
};
vector signed int b = {
5, 30, -25, 10
};
vector signed int result = vec_min(a, b);
printf("Result: [");
for (int i = 0; i < 4; ++i) {
printf("%d", ((int*)&result)[i]);
if (i < 3) printf(", ");
}
printf("]\n");
return 0;
}
Assembly Instruction:
vminsh
Usage:
vector signed short result =
vec_min(
vector signed short a, vector signed short b
)
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
vector signed short a = {
-25, 45, -10, 60, -30, 70, -20, 80
};
vector signed short b = {
10, 50, -20, 65, -25, 75, -15, 85
};
vector signed short result = vec_min(a, b);
printf("Result: [");
for (int i = 0; i < 8; ++i) {
printf("%d", ((short*)&result)[i]);
if (i < 7) printf(", ");
}
printf("]\n");
return 0;
}
Assembly Instruction:
vminuh
Usage:
vector unsigned short result =
vec_min(
vector unsigned short a, vector unsigned short b
)
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
vector unsigned short a = {
30, 50, 40, 70, 25, 60, 35, 80
};
vector unsigned short b = {
20, 55, 45, 75, 30, 65, 40, 85
};
vector unsigned short result = vec_min(a, b);
printf("Result: [");
for (int i = 0; i < 8; ++i) {
printf("%u", ((unsigned short*)&result)[i]);
if (i < 7) printf(", ");
}
printf("]\n");
return 0;
}
Assembly Instruction:
vminub
Usage:
vector unsigned char result =
vec_min(
vector unsigned char a, vector unsigned char b
)
Example:
#include <altivec.h>
#include <stdio.h>
int main() {
vector unsigned char a = {
30, 40, 50, 60, 70, 80, 90, 100, 25, 35, 45, 55, 65, 75, 85, 95
};
vector unsigned char b = {
20, 50, 40, 70, 65, 85, 95, 100, 30, 45, 55, 60, 80, 90, 100, 105
};
vector unsigned char result = vec_min(a, b);
printf("Result: [");
for (int i = 0; i < 16; ++i) {
printf("%d", ((unsigned char*)&result)[i]);
if (i < 15) printf(", ");
}
printf("]\n");
return 0;
}
SIMD Intrinsics Summary
| SIMD Engines: | 6 |
| C Intrinsics: | 10444 |
| NEON: | 4353 |
| AVX2: | 405 |
| AVX512: | 4717 |
| SSE4.2: | 598 |
| VSX: | 192 |
| IBM-Z: | 179 |