Zig Version
0.15.2
Steps to Reproduce and Observed Behavior
I have a combined zig and c++ project that runs on a teensy 4.1 (ARM Cortex M7). The C++ is compiled with gnu arm-none-eabi-g++ and the zig is compiled into a shared library and then they both communicate via the C ABI. Since the cortex m7 has hardware float support, I am compiling the libs with: -mcpu cortex_m7 -target arm-freestanding-eabihf, however, I have noticed that zig is still using the software float abi. For the below function:
pubexportfnfloats(fl:f32)f32{constret=fl+1.0;returnret;}The compiled assembly (built with zig build-lib -mcpu cortex_m7 -target thumb-freestanding-eabihf, obtained with gcc's arm-none-eabi-objdump -d) is:
floats:
push {r7, lr}
mov r7, sp
sub sp, #8
str r0, [sp, #4]
mov.w r1, #1065353216 ; 0x3f800000
bl 0 <__aeabi_fadd>
add sp, #8
pop {r7, pc}
nop
nop
Whereas the equivalent c++ function is:
floats2(float):
vmov.f32 s15, #112 ; 0x3f800000 1.0
push {r7}
vadd.f32 s0, s0, s15
add r7, sp, #0
mov sp, r7
ldr.w r7, [sp], #4
bx lr
The difference between the two is that the c++ version uses s0, s1, ... for floating point numbers (which I believe is the correct behavior for hardware floating point numbers (eabihf)), whereas the zig version uses the integer registers r0, r1, ... for taking in parameters
Expected Behavior
I would expect zig to use the floating point registers for floating point parameters and return values when compiled with eabihf rather than using the integer registers (which is correct for eabi, but not eabihf)