https://bugs.llvm.org/show_bug.cgi?id=38599

            Bug ID: 38599
           Summary: wasm32 reduce.fmin/fmax work incorrectly for <float x
                    32> vectors containing NaNs
           Product: new-bugs
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: gonzalob...@gmail.com
                CC: llvm-bugs@lists.llvm.org

This is an attempt at reporting Rust packed_simd/91
(https://github.com/rust-lang-nursery/packed_simd/issues/91). 

There we have to functions, min_element and max_element, that work on packed
float vectors. For <4 x float> and min we emit the following LLVM-IR:

define float @min_4x32(<4 x float> %a) {
  %b = tail call float @llvm.experimental.reduce.fmin.v4f32(<4 x float> %a)
  ret float %b
}
declare float @llvm.experimental.reduce.fmin.v4f32(<4 x float>)

We have a test that initializes the first element of the vector with NaN, and
all other elements with 3.0, and checks that the result is 3.0. 

This tests passes on wasm32-unknown-unknown for all f32 and f64 vectors except
for f32x16 (512-bit wide) vectors, where it fails for both the `min` and `max`
operations. Instead of returning `3.0`, this functions return `NaN` (the input
is `<float x16> <NaN, 3.0, ..., 3.0>`.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to