__lsx_vfmaxa_s
LSX intrinsic · group: Floating Point Computation
Synopsis
__m128 __lsx_vfmaxa_s (__m128 a, __m128 b)
#include <lsxintrin.h>
Instruction: vfmaxa.s vr, vr, vr
CPU Flags: LSX
Description
Compute the maximum (maxNumMag) of single precision floating point elements in a and b, selecting the element with the larger absolute value.
Operation
for (int i = 0; i < 4; i++) {
if (abs(a.fp32[i]) > abs(b.fp32[i])) {
dst.fp32[i] = a.fp32[i];
} else if (abs(b.fp32[i]) > abs(a.fp32[i])) {
dst.fp32[i] = b.fp32[i];
} else {
dst.fp32[i] = fmax(a.fp32[i], b.fp32[i]);
}
}
Tested on real machine.
Latency and Throughput
| CPU | µarch | Latency | Throughput (IPC) |
|---|---|---|---|
| 3C5000 | LA464 | 2 | 2 |
| 3A6000 | LA664 | 2 | 4 |
| 3C6000 | LA664 | 2 | 4 |
| 2K1000LA | LA264 | 2 | 1 |
| 2K3000 | LA364E | 2 | 1 |