Add 32-bit floats in eax/ecx registers?

vgel

I have a pair of 32-bit floats stored in eax and ecx. Can I directly load these into the FPU to operate on them, without first storing to memory? This would simplify some compiler code significantly, but fld seems to only be able to operate on memory.

Jester

No, you can't do that. As far as generating code goes, you can simulate fld r32 easily enough through the following sequence for example (optimized for size ;)) :

push r32
fld [esp]
pop r32

Consider using SSE if available, which does offer direct GPR-to-XMM moves using the movd instruction. Adding the two registers could then look something like:

movd xmm0, eax
movd xmm1, ecx
addss xmm0, xmm1

If you need the result in a GPR, you can move it back using another movd.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Add 32-bit floats in eax/ecx registers?

From Dev

32 bit registers act as 8 bit ones

From Dev

Real Mode 32-bit registers

From Dev

Assembly: 64 bit multiplication with 32-bit registers

From Dev

Wix: How to write to 32bit registers on 64 bit machine

From Dev

IA-32 assembly: Effect of 8 bit operations on 32 bit registers

From Dev

Assembly 8088: 32-bit signed Multiplication with addition and bit manipulation using 16-bit registers

From Dev

Data size for ascii representation of 32bit floats

From Dev

Assembly: division using the values in two 32-bit registers as if they were one 64-bit integer

From Dev

Recieving 32-bit registers from 64-bit nasm code

From Dev

Assembly: division using the values in two 32-bit registers as if they were one 64-bit integer

From Dev

Recieving 32-bit registers from 64-bit nasm code

From Dev

SSE intrinsics: Convert 32-bit floats to UNSIGNED 8-bit integers

From Dev

Z3Py: How should I represent some 32-bit; 16-bit and 8-bit registers?

From Dev

Can I add 64bit constants to 64bit registers?

From Dev

Can I add 64bit constants to 64bit registers?

From Dev

SSE 64 bit registers

From Dev

C Bit masking registers

From Dev

C Bit masking registers

From Dev

The advantages of using 32bit registers/instructions in x86-64

From Dev

How to push (and pop) floating-point registers to the stack on ARMv7 32-bit?

From Dev

How is 32bit Linux virtual memory structured in relation to PCIe Base Address Registers

From Dev

How to push (and pop) floating-point registers to the stack on ARMv7 32-bit?

From Dev

Why does the sys_write call in 64-bit addressing work fine with args in registers intended to 32-bit addressing

From Dev

Why does the sys_write call in 64-bit addressing work fine with args in registers intended to 32-bit addressing

From Dev

Are Floats' Bit Patterns Ordered?

From Dev

Are Floats' Bit Patterns Ordered?

From Dev

Bit wise 'AND' an array of registers in Verilog

From Dev

How to pack 16 16-bit registers/variables on AVX registers

Related Related

  1. 1

    Add 32-bit floats in eax/ecx registers?

  2. 2

    32 bit registers act as 8 bit ones

  3. 3

    Real Mode 32-bit registers

  4. 4

    Assembly: 64 bit multiplication with 32-bit registers

  5. 5

    Wix: How to write to 32bit registers on 64 bit machine

  6. 6

    IA-32 assembly: Effect of 8 bit operations on 32 bit registers

  7. 7

    Assembly 8088: 32-bit signed Multiplication with addition and bit manipulation using 16-bit registers

  8. 8

    Data size for ascii representation of 32bit floats

  9. 9

    Assembly: division using the values in two 32-bit registers as if they were one 64-bit integer

  10. 10

    Recieving 32-bit registers from 64-bit nasm code

  11. 11

    Assembly: division using the values in two 32-bit registers as if they were one 64-bit integer

  12. 12

    Recieving 32-bit registers from 64-bit nasm code

  13. 13

    SSE intrinsics: Convert 32-bit floats to UNSIGNED 8-bit integers

  14. 14

    Z3Py: How should I represent some 32-bit; 16-bit and 8-bit registers?

  15. 15

    Can I add 64bit constants to 64bit registers?

  16. 16

    Can I add 64bit constants to 64bit registers?

  17. 17

    SSE 64 bit registers

  18. 18

    C Bit masking registers

  19. 19

    C Bit masking registers

  20. 20

    The advantages of using 32bit registers/instructions in x86-64

  21. 21

    How to push (and pop) floating-point registers to the stack on ARMv7 32-bit?

  22. 22

    How is 32bit Linux virtual memory structured in relation to PCIe Base Address Registers

  23. 23

    How to push (and pop) floating-point registers to the stack on ARMv7 32-bit?

  24. 24

    Why does the sys_write call in 64-bit addressing work fine with args in registers intended to 32-bit addressing

  25. 25

    Why does the sys_write call in 64-bit addressing work fine with args in registers intended to 32-bit addressing

  26. 26

    Are Floats' Bit Patterns Ordered?

  27. 27

    Are Floats' Bit Patterns Ordered?

  28. 28

    Bit wise 'AND' an array of registers in Verilog

  29. 29

    How to pack 16 16-bit registers/variables on AVX registers

HotTag

Archive