<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - llvm.experimental.vector.reduce.{fmin,fmax} broken on Mips"
   href="https://bugs.llvm.org/show_bug.cgi?id=38287">38287</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm.experimental.vector.reduce.{fmin,fmax} broken on Mips
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dragan.mladjenovic@rt-rk.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20596" name="attach_20596" title="Reproducer">attachment 20596</a> <a href="attachment.cgi?id=20596&action=edit" title="Reproducer">[details]</a></span>
Reproducer

Running the attached reproducer on trunk after rL332358 results in error:

LLVM ERROR: Cannot select: 0x55877f48eda0: v2i64 = setcc 0x55877f48ed38,
0x55877f48f218, setlt:ch
  0x55877f48ed38: v2f64 = bitcast 0x55877f48f350
    0x55877f48f350: v2i64 = insert_vector_elt 0x55877f48f280, 0x55877f48ec68,
Constant:i32<1>
      0x55877f48f280: v2i64 = insert_vector_elt 0x55877f48ecd0, 0x55877f48eb98,
Constant:i32<0>
        0x55877f48ecd0: v2i64 = BUILD_VECTOR Constant:i64<0>, Constant:i64<0>
          0x55877f48f010: i64 = Constant<0>
          0x55877f48f010: i64 = Constant<0>
        0x55877f48eb98: i64,ch = CopyFromReg 0x55877f429508, Register:i64 %0
          0x55877f48eb30: i64 = Register %0
        0x55877f48ef40: i32 = Constant<0>
      0x55877f48ec68: i64,ch = CopyFromReg 0x55877f429508, Register:i64 %1
        0x55877f48ec00: i64 = Register %1
      0x55877f48f2e8: i32 = Constant<1>
  0x55877f48f218: v2f64 = bitcast 0x55877f48efa8
    0x55877f48efa8: v2i64 = BUILD_VECTOR 0x55877f48ec68, 0x55877f48ec68
      0x55877f48ec68: i64,ch = CopyFromReg 0x55877f429508, Register:i64 %1
        0x55877f48ec00: i64 = Register %1
      0x55877f48ec68: i64,ch = CopyFromReg 0x55877f429508, Register:i64 %1
        0x55877f48ec00: i64 = Register %1

Before the rL332358 the 'setcc setolt' wasn't replaced with 'setcc setlt' which
Mips backend can't select on v2f64 types. 

Possibly a second issue is that reduction expansion produces same 'fcmp fast
olt' even when intrinsic is not used in fastmath context.


*** IR Dump After Expand reduction intrinsics ***
; Function Attrs: uwtable
define double @test(<2 x double>) unnamed_addr #0 {
start:
  %rdx.shuf = shufflevector <2 x double> %0, <2 x double> undef, <2 x i32> <i32
1, i32 undef>
  %rdx.minmax.cmp = fcmp fast olt <2 x double> %0, %rdx.shuf
  %rdx.minmax.select = select <2 x i1> %rdx.minmax.cmp, <2 x double> %0, <2 x
double> %rdx.shuf
  %1 = extractelement <2 x double> %rdx.minmax.select, i32 0
  ret double %1
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>