I think this is less about memory speed and more about compiler optimizations.
Modern compilers on modern architectures (64-bit x86) will optimize this code only to use register mov's. No memory operations.
Here's an example: https://godbolt.org/z/1lq4bZ
Float is passed in xmm0 register. Integer return value should be in eax register. Compiler simply moved bits from one register to another. No memory operations.
Same for arm64: https://godbolt.org/z/uo2H4o
For accessing SSE register as individual floats looks like this: https://godbolt.org/z/xEWs1x
Again, no memory operations - just some register shuffling.