Reputation: 387
For example, 0.5f is 0x3F000000 in the target platform. I want to use something like movl $0.5,%eax
instead of movl $0x3F000000,%eax
The assembler is from TDM-GCC.
Upvotes: 2
Views: 451
Reputation: 41805
You need to declare a separate constant with either .float
, .single
or .double
directives
For example
.data
half: .float 0.50
.text
.globl _start
_start:
movl half, %eax
https://en.wikibooks.org/wiki/X86_Assembly/AVX,_AVX2,_FMA3,_FMA4
You can also use E/F/G/H constraints in inline assembly
static const float half = 0.5f;
__asm__ __volatile__ ("\n\
movl %1, %eax %1"
: "g" (half)
) ;
Upvotes: 2