[llvm-bugs] [Bug 38599] New: wasm32 reduce.fmin/fmax work incorrectly for <float x 32> vectors containing NaNs

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 16 08:53:18 PDT 2018


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: unassignedbugs at nondot.org
          Reporter: gonzalobg88 at gmail.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180816/118725e0/attachment-0001.html>


More information about the llvm-bugs mailing list