<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95284>95284</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[RISCV] Regression due to creation of avgfloors nodes
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:RISC-V,
llvm:codegen
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
RKSimon
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RKSimon
</td>
</tr>
</table>
<pre>
```ll
; llc -mtriple=riscv64 test.ll -o -
define signext i64 @func000000000000002b(i32 signext %0) #0 {
entry:
%1 = zext nneg i32 %0 to i64
%2 = add nsw i64 %1, -1
%3 = lshr i64 %2, 1
%4 = add nuw nsw i64 %3, 1
%5 = and i64 %4, 9223372036854775806
ret i64 %5
}
```
Before:
```asm
func000000000000002b:
addi a0, a0, -1
srli a0, a0, 1
addi a0, a0, 1
andi a0, a0, -2
ret
```
After:
```asm
func000000000000002b:
addi a0, a0, -1
srli a0, a0, 1
addi a0, a0, 1
li a1, -3
srli a1, a1, 1
and a0, a0, a1
ret
```
Reported by @dtcxzyw on #92096
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlM1u6yoQx58Gb5AjPPhz4UXSKNLV3aVS99iMHe4lJgKcNn36I0zS5OS0-4MsbJjf_GHGMMI5NU6ILSk2BGD_76s6mokAkGKbiNkfjG2vk0ln5KUlJYuP1oRtCVsTvqFa9zQ9eqtOGgnfWuX6c5lTj86vtKapoWmEJQ5qQrqs-eGpKnNKcjbMU89-a9ARqBWHL5JAwQg0lABnlFSbKIeTtxfC13FEA5VRwrf0M_hME440iARn6k1Y7oGEhRRS0sm9x61AkRF4oWn2gPEF0-5gbwwE5hHJ70rz-6MafyaLSE7yRuSBaAA4r4Dxsi7yqipqVt58LPobWlzzXW2vH7c_EYcbHIzFr2R8WYU7xplvs3zPXWxCSkUFC7uK_T0XsTmr1QI-MNk3Gj8gYvrTlsLVaNF_G9p68Gj_9siiM6UiHiH-g_hijf2z-CTps7h4Yn7KUOz3eDLWo6TdJVwr6fuPz8s7NVO4Ng2wpkxky2XDG5Fgm1VZDVmZZ1lyaKsqz5BL7IBj3kgOZV9mddn1TVHzBotEtcAgZ2UGWQ0sy1YFG0RdYCOGAgTyiuQMj0Lpldbn48rYMVHOzdg2BdR5okWH2l2rTCf6_3GShK_3_7y-pG-h3MALAQiuhK97I3HEWxWybZhOu3l0JGdaOe_ua3jl9VK8gtIbKbZ0j6NF55SZqJwxXPveovBhbAYqzuOgjbGOTkaiS2ar24P3JxfOC-wI7EblD3O36s2RwG7ZUHylJ2v-w94T2C2BOQK7GNu5hV8BAAD__8BmXNE">