<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/101526>101526</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[RISCV] float to int conversion intrinsics are incorrectly enabled without Zfh.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:RISC-V
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
4vtomat
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
topperc
</td>
</tr>
</table>
<pre>
We have this code in SemaRISCV.cpp to disable f16 intrinsics without Zvfh.
```
if (BaseType == BasicType::Float16) {
if ((Record.RequiredExtensions & RVV_REQ_Zvfhmin) == RVV_REQ_Zvfhmin) {
if (!TI.hasFeature("zvfhmin"))
continue;
} else if (!TI.hasFeature("zvfh")) {
continue;
}
}
```
For the conversion intrinsics, the BaseType is integer, not floating point, so we miss this check if any of the source operands are Float16.
CC: @jacquesguan @kito-cheng @rofirrim
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU0tvozAQ_jXmMgoC80hy4JBHkXrctMpKe6mMmcC0YFPbpJv99StTuul2K3UtZDQzmu_zPD5hLTUKsWDZlnGenp3uhWOcs2wfiNG12hRODwMaGVS6vhTfEVpxRnAtWZC6RiAFd9iLw-3d7hjKYQCnoSYrqg7hFOdAyhlSlqSFF3KtHh38OJ_akEV7Fm3mO4_mbzJhOnQCxldbYfH-MiCwZM-SPWyFJekdLNmwZFN2Wrg4Z3wNbLmF9_lvCIyvDii1qcMDPo9ksL756VBZ0soC4zkcjseHw823B_-sntSE9Ur2WWS5hQ80V6L4_jZshS1RuNHg5OK_3nI542uP8L9nJpFaOVIjsuRjeWy5B-wsfkl_5f63R_AFwXvP1f4wsNe71AZcix7wjMb3993wGd9NwT_zJOuj2KDxIaUdnPwsSTUwaFLOe62GF4SerJ0XrkX55MsV6gL6NAFaPRqJoAc0QtUWhEGYt-KvHdvtWLIBlkaPQj6PaJtRKG8-kdML2aJqvGX0iYyhHoK6SOp1shYBFvGS8yxJEp4GbVFXWc7jZRqLLIoxFRXmVSqjdF3jOs0TEVDBI55GqyiOl3yVpmEkM7nisRCreJnEq4ilEfaCurDrzn2oTROQtSMWcRRnPA86UWFnZ0VWQj6hqlmy8QJbHGdpmsLnLqqxsSyNOrLOXtEcuW5S9KRJlu1fO-uFScp9Pp6pbaSkNgal6y6Ayiu4vmr21IbBaLqidW6wXny8ZLxsyLVjFUrdM176F8y_xWD0I0rHeDkVZxkv5_rOBf8dAAD__2TEUhA">