check that rustc knows it can use the FPU #30

Closed
opened 2020-07-02 20:03:16 +08:00 by sb10q · 7 comments
There is no content yet.

It seems to me that rustc is generating softfp instead of using the FPU right now.

00136738 __aeabi_fmul:
  136738: 34 03 00 ea                   b       #3280 <_ZN17compiler_builtins5float3mul8__mulsf317heaf846efb5e7e2baE>

...

00137410 _ZN17compiler_builtins5float3mul8__mulsf317heaf846efb5e7e2baE:
  137410: fc 48 2d e9                   push    {r2, r3, r4, r5, r6, r7, r11, lr}
  137414: a0 2b a0 e1                   lsr     r2, r0, #23
  137418: 00 60 e0 e3                   mvn     r6, #0
  13741c: 00 50 a0 e1                   mov     r5, r0
  137420: 72 70 e6 e6                   uxtab   r7, r6, r2
  137424: 00 20 21 e0                   eor     r2, r1, r0
  137428: 02 41 02 e2                   and     r4, r2, #-2147483648
  13742c: 01 20 a0 e1                   mov     r2, r1
  137430: 00 c0 00 e3                   movw    r12, #0
  137434: d1 eb e7 e7                   ubfx    lr, r1, #23, #8
  137438: 9f 2b df e7                   bfc     r2, #23, #9
  13743c: 9f 5b df e7                   bfc     r5, #23, #9
  137440: d0 3b e7 e7                   ubfx    r3, r0, #23, #8
  137444: fd 00 57 e3                   cmp     r7, #253
  137448: 80 cf 47 e3                   movt    r12, #32640
  ...
It seems to me that rustc is generating softfp instead of using the FPU right now. ``` 00136738 __aeabi_fmul: 136738: 34 03 00 ea b #3280 <_ZN17compiler_builtins5float3mul8__mulsf317heaf846efb5e7e2baE> ... 00137410 _ZN17compiler_builtins5float3mul8__mulsf317heaf846efb5e7e2baE: 137410: fc 48 2d e9 push {r2, r3, r4, r5, r6, r7, r11, lr} 137414: a0 2b a0 e1 lsr r2, r0, #23 137418: 00 60 e0 e3 mvn r6, #0 13741c: 00 50 a0 e1 mov r5, r0 137420: 72 70 e6 e6 uxtab r7, r6, r2 137424: 00 20 21 e0 eor r2, r1, r0 137428: 02 41 02 e2 and r4, r2, #-2147483648 13742c: 01 20 a0 e1 mov r2, r1 137430: 00 c0 00 e3 movw r12, #0 137434: d1 eb e7 e7 ubfx lr, r1, #23, #8 137438: 9f 2b df e7 bfc r2, #23, #9 13743c: 9f 5b df e7 bfc r5, #23, #9 137440: d0 3b e7 e7 ubfx r3, r0, #23, #8 137444: fd 00 57 e3 cmp r7, #253 137448: 80 cf 47 e3 movt r12, #32640 ... ```

The demangled name for that compiler builtin is compiler_builtins::float::mul::__mulsf3, clearly it is soft fp.

The demangled name for that compiler builtin is `compiler_builtins::float::mul::__mulsf3`, clearly it is soft fp.

Nevermind, rustc knows to generate the fpu instruction, my previous code was too trivial and the compiler optimized that into other instructions.
Here is what the compiler generated when I have a more complicated operation:

12bae4: 02 0b 20 ee                   vmul.f64        d0, d0, d2

I think we can close this issue.

Nevermind, rustc knows to generate the fpu instruction, my previous code was too trivial and the compiler optimized that into other instructions. Here is what the compiler generated when I have a more complicated operation: ```asm 12bae4: 02 0b 20 ee vmul.f64 d0, d0, d2 ``` I think we can close this issue.

The previous __aeabi_fmul is an unused symbol, idk why it is still there after the LTO.

The previous `__aeabi_fmul` is an unused symbol, idk why it is still there after the LTO.
Poster
Owner

It is exposed to the kernel with api!(__aeabi_fmul), so it is not an unused symbol at least as far as the runtime (not szl) is concerned.

It is exposed to the kernel with ``api!(__aeabi_fmul)``, so it is not an unused symbol at least as far as the runtime (not szl) is concerned.

Should we provide them with FPU instead? These use softfp which would be pretty slow.

Should we provide them with FPU instead? These use softfp which would be pretty slow.
Poster
Owner

They use the FPU already. I think @astro simply included all available aeabi symbols including those that the kernels are not supposed to use.

They use the FPU already. I think @astro simply included all available aeabi symbols including those that the kernels are not supposed to use.
sb10q closed this issue 2020-07-07 09:55:14 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/artiq-zynq#30
There is no content yet.