-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new instructions: min / max #33
Comments
There is another case where the underlying instruction differ: when one input is +0.0 and the other is -0.0 |
Thanks for pointing that out, I hadn't considered it ☹. I updated the description to make that implementation-defined as well. |
For RISC-V V extension, vector float min/max follows scalar semantics, copied the relevant paragraph:
Note that this is different from x86/arm for
|
Lookingat PowerISA V2.07B has vminfp, vmaxfp, where:
|
Prototype F32x4Relaxed(Min/Max) and F64x2Relaxed(Min/Max) operations for ARM. F32x4 variants map directly to vmin/vmax hardware instructions which are also used for F32x4(Min/Max) operations. The F64x2 variants are mapped in this implementation to Pmin/Pmax instructions as detailed in the github issue. WebAssembly/relaxed-simd#33 Bug: v8:12284 Change-Id: I5ea939385fa0ae97bbdf776fc0b763cabb1b293c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3501347 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Deepti Gandluri <gdeepti@chromium.org> Cr-Commit-Position: refs/heads/main@{#79355}
Return the lane-wise minimum or maximum of two values. If either is NaN, or the values are -0.0 and +0.0, then which value will be returned is implementation-defined.
x86-64 and ARM64. Also provide reference implementation in terms of 128-bit
Wasm SIMD.
Pretty much all architectures which support SIMD have min / max instructions. On those platforms, these would be mapped to those instructions.
relaxed f32x4.min
:minps
vmin.f32
fmin
orfminnm
vminfp
xvminsp
fmin.w
relaxed f32x4.max
:maxps
vmax.f32
fmax
orfmaxnm
vmaxfp
xvmaxsp
fmax.w
relaxed f64x2.min
:minpd
fmin
orfminnm
xvmindp
fmin.d
relaxed f64x2.max
:maxpd
fmax
orfmaxnm
xvmaxdp
fmax.d
On platforms where no hardware support is available, implementations could use the same code they use for the
pmin
/pmax
instructions (ormin
/max
if they prefer, or some other sequence).Different processors will return different results if one of the inputs is NaN.
fmin
/fmax
, Arm will always return NaN if either input is NaNfminnm
/fmaxnm
.Whenever you want the minimum or maximum of two values and don't have NaNs in your data. Currently the programmer must choose between instructions which will perform sub-optimally on Arm (
pmin
/pmax
) or x86 (min
/max
); with these instructions the fastest implementation will be selected automatically.The text was updated successfully, but these errors were encountered: