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

    <tr>
        <th>Summary</th>
        <td>
            [LoongArch] Compiler crash when converting `half` to `i32`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    ### How to reproduce:

```llvm
define signext i32 @test_half_to_i32(half %a) nounwind {
entry:
  %conv = fptosi half %a to i32
  ret i32 %conv
}
```

### Expected result:

Build successful.

### Unexpected result:

```
SoftPromoteHalfOperand Op #0: t10: f32 = LoongArchISD::FTINT t4

LLVM ERROR: Do not know how to soft promote this operator's operand!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: dbg/bin/llc --mtriple loongarch64 -o - t.ll
1.      Running pass 'Function Pass Manager' on module 't.ll'.
2.      Running pass 'LoongArch DAG->DAG Pattern Instruction Selection' on function '@test_half_to_i32'
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVEFv5CgT_TX4UuoWBredPvjgfE7PRMp8aaVn9xphjG02GCwokpl_v8Lu7Y1Ws5eVkGxQ1Xuv6hWIEPRolarJ4Z4wNik9KU8YI4c2ExEn5-vtLOtc_7MmjG8LvroPQAdeLd71USrCG0LXVdJtGfM-E9r0atBWwUrzA0FzBqSgqAK-TsIMr-heNWeE3aUdEHYQhB3Bumg_tO2BVPeENsqi_7lRQIqRzr4D4S0MC7qg4ZabNCW4FOfVlW6LT9qq9rPCq-BbTQ8_FiVR9eBViAZvJd1HbXoIUUoVwhDN_p-Jv1n1L6mfuS5uwLN3s0P1VZjheVFe2B6eFyCMU8IbwHz9DEk0b-HJOTs2Xk6PlzYh8ub0_fH_3wGLDfzp6fdv8PDy8vySsloH1iG8WfcB0-ZOcAPCslECTjqAS6ToPGHVdWN7wnJCm_PTQ3N5gBC7WSMI6OKY3HUeE9KEuISkgZ0IO40ap9jtpZsJO60-b5_d4t0fSiJhJx1CVIGwE6QatZUm9kmDAulFmKAT8g29kCo184JCvkEf52VrHN0Tejx7N3oxg_BjnJXFRA99NxJ26rRdGSXsdjN6vRgFJjVLeDmVBewc7AD3xhDa5AnrJVqr7QiLCAEIq07RStTOwjkdfBNWjGnsK3AWZtdHo1LUisCqpJD9CuXmD7TNlx3hD23zBc4CUXkLjzagjxvLRRm1_l0phr_oCat-eRmqz6OT9TXvj_woMlXnFed5cTyWZTbVhyPPOzkcS3pXcioOlB6HTlQ5pTllvRwyXTPKipxRlhecFeVedb3gRV6xg-wrJu5IQdUstNkn9_bOj9nqW53nd5zmmRGdMmF9Gw5t5uvV4y6OgRTU6IDh7zzUaNZX5NYUcmjhf25etFH-avrHpCyku6g8pkaSkqaySUnTjJGSpuJLmkVv6v8-cVfx7zX7MwAA__-KpoGE">