[llvm] [WebAssembly] Use generic pseudo_fmin/pseudo_fmax opcodes (PR #208454)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 06:02:57 PDT 2026


================
@@ -318,9 +318,12 @@ define <4 x float> @test_pmax_v4f32_ole(<4 x float> %x, <4 x float> %y) {
 ; CHECK-LABEL: test_pmax_v4f32_ole:
 ; CHECK:         .functype test_pmax_v4f32_ole (v128, v128) -> (v128)
 ; CHECK-NEXT:  # %bb.0:
+; CHECK-NEXT:    local.get 1
+; CHECK-NEXT:    local.get 0
 ; CHECK-NEXT:    local.get 0
 ; CHECK-NEXT:    local.get 1
-; CHECK-NEXT:    f32x4.pmax
+; CHECK-NEXT:    f32x4.le
+; CHECK-NEXT:    v128.bitselect
----------------
nikic wrote:

This is a case that previously incorrectly used pmax.

Here we have `y oge x ? y : x`, while pmax is `y ogt x ? y : x`. If x==0.0 and y==-0.0, then the former will return -0.0 and the latter will return 0.0.

It's also not possible to salvage this by swapping, because that would result in the wrong behavior for NaNs instead.

https://github.com/llvm/llvm-project/pull/208454


More information about the llvm-commits mailing list