<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63917>63917</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Extension zfinx does not work with fastcc
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:RISC-V
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nigelp-xmos
</td>
</tr>
</table>
<pre>
This problem occurred in a real-world newlib source file. I've reduced it to the test code below.
Using Clang optimize for size, `clang -Os -march=rv32im_zfinx`, generates `fastcc` calls in IR. Code generation crashes in `copyPhysReg`.
RISCVISelLowering.cpp RISCV::CC_RISCV_FastCC allocates an F register for an argument. The F registers do not exist under ZFINX. Then copyPhysReg reaches its llvm_unreachable().
ABI is ILP32.
`float p[5], q[5];
static float f(float x)
{
float r = 1.0+x*(p[0]+p[1]+p[2]+p[3]+p[4]);
float s = 1.0+x*(q[0]+q[1]+q[2]+q[3]+q[4]);
return r/s;
}
volatile float k;
float caller1(float x) {
return k + f(x);
}
float caller2(float x) {
return k * f(x);
}`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE2P4ygQ_TX4UoqFcezEBx_ysZEijXZHPbOj1V5aGFdstjE4gDvp_vUrSGadnp3DXJIX6vHq8aDCnZOdRqxJsSXFPuGT742ttexQjYvrYFzSmPat_tpLB6M1jcIBjBCTtdiC1MDBIleLi7GqBY0XJRtwZrIC4SQVpnAkbPWKYLGdRNjiwRvwPYJH50GYFqFBZS4poXtCN7fPP53UHewU1x2Y0ctBviOcjAUn35GwHZCSilhd_OFgMXArepLv7WvO5PD8fpL6SkoaiB1qtNyjC1tO3HkhSElBcKVc8H98SgF2wcWdKY0GYbnrMdZDIzO-fe7f3BN2pKQffD4dv-y-Hb-g-mQuaKXuUjGOEFdJviH5Zrd7jr-eD9z53Q64UkZEO1zDASx20nm08WxcA7fdNKD2KXzt8aHuoDWgjQe8Sudh0i1a-Ptw_P2vyNTw4DFciIjuvQOlXofnSccl3igkbE1Y9eEMm-0RpIPjp885-1AIgSnDPYyk2Bak2Ic8z99xvn3kOs-9FHDjnwhb39CVsOpOW935d44Fku8hSylh2ythG8LWoQ2NbbYBZjNkM8xnuIyw-s8J3KXd_6XPs_R5lj7P0udZ-vxTaYt-shosYQc3n321fwzh1SjupcK7j5cfMrqthpeHNvsQEczpfG_0AoRtY5LXRyM_dHyUZL8iufm5ZEmTts7bKq94gnVWrqsyY6tqlfS1yAvW4jKnBUVasUacmlOTnZZ5teRVQWkia0ZZTlfZKiuLPFulZbsuClYg5WK5zvBElhQHLlUaHmNqbJdI5yasy7zKVoniDSoX_38Ya7h4Qd2SPE7W4hth4X4SW4eti2bqHFlSJZ13s5iXXmH929WjdmF44_RDa9DFibkY-wIX6Xu4TX8yWVX33o8uTCg7EHbopO-nJhVmIOwQdO9fi9Gaf1B4wg7RsSPsEE3_GwAA__9dBY4B">