SHARE
TWEET

Untitled

a guest Oct 20th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. C code
  2. ```
  3. double __attribute__((pcs("aapcs"))) f2d(float f) {
  4. return (double)f;
  5. }
  6.  
  7. double __attribute__((pcs("aapcs-vfp"))) __hard_f2d(float f){
  8. return (double)f;
  9. }
  10.  
  11. double __attribute__((pcs("aapcs-vfp"))) __hard_powd(double d){
  12. return d*d;
  13. }
  14. double __attribute__((pcs("aapcs"))) __softfp_powd(double d){
  15. return d*d;
  16. }
  17. ```
  18. can be compiled both ways  with same result
  19. ```
  20. arm-none-eabi-gcc -O -c armfloat.c -mfloat-abi=hard
  21. arm-none-eabi-gcc -O -c armfloat.c -mfloat-abi=softfp
  22. ```
  23. `arm-none-eabi-objdump -d armfloat.o` produces
  24. ```
  25.  
  26. armfloat.o:     file format elf32-littlearm
  27.  
  28.  
  29. Disassembly of section .text:
  30.  
  31. 00000000 <f2d>:
  32.    0:   ee070a90        vmov    s15, r0
  33.    4:   eeb77ae7        vcvt.f64.f32    d7, s15
  34.    8:   ec510b17        vmov    r0, r1, d7
  35.    c:   e12fff1e        bx      lr
  36.  
  37. 00000010 <__hard_f2d>:
  38.   10:   eeb70ac0        vcvt.f64.f32    d0, s0
  39.   14:   e12fff1e        bx      lr
  40.  
  41. 00000018 <__hard_powd>:
  42.   18:   ee200b00        vmul.f64        d0, d0, d0
  43.   1c:   e12fff1e        bx      lr
  44.  
  45. 00000020 <__softfp_powd>:
  46.   20:   ec410b17        vmov    d7, r0, r1
  47.   24:   ee277b07        vmul.f64        d7, d7, d7
  48.   28:   ec510b17        vmov    r0, r1, d7
  49.   2c:   e12fff1e        bx      lr
  50. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top