<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/70061>70061</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [RISC-V] `llvm.*maximum`/`llvm.*minimum` can't be lowered to soft floats
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            backend:RISC-V
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          dcaballe
      </td>
    </tr>
</table>

<pre>
    Hi there,

It looks like `llvm.maximum` and `llvm.vector.reduce.fmaximum` (and I assume the minimum counterparts as well) can't be lowered to soft floats.

Repro:

```
define float @test(<4 x float> %in, float %in2, float %in3) {
  %mr = tail call float @llvm.vector.reduce.fmaximum.v4f32(<4 x float> %in)
  %m = tail call float @llvm.maximum.f32(float %in2, float %in3)
  %res = fadd float %m, %mr
 ret float %res
}

declare float @llvm.vector.reduce.fmaximum.v4f32(<4 x float>)

declare float @llvm.maximum.f32(float, float)
```

```
llc -mattr=+m -mtriple=riscv32-pc-linux-elf -target-abi=ilp32 test.ll

SoftenFloatResult #0: t46: f32 = fmaximum t35, t34

LLVM ERROR: Do not know how to soften the result of this operator!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc -mattr=+m -mtriple=riscv32-pc-linux-elf -target-abi=ilp32 test.ll
1. Running pass 'Function Pass Manager' on module 'test.ll'.
2.      Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@test'
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VVFv4jgQ_jXmZQRKbEjggQfalL1KXV1FpX134knw4diRPW57__7khAK36nWlOx1CSTwef_N9Y49HhqA7i7hlqzu2qmYy0tH5rWpkLY3BWe3Un9vfNNARPTJ-z7KKZbvp-UhgnDsFMPqEwIrMmNd-0ct33ceeFRlIqy7mV2zI-YV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