Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Bug in the gnu assembler for the MIC

Paul_C_7
Beginner
654 Views

I am using the gnu assembler with intel syntax for the MIC and I am encountering a bug in its store addressing.

I want to move an interger from the FPU to the eax register and I am doing it by the following sequence of source:

sub rsp,8
fistp dword ptr [rsp]
mov eax,dword [rsp]
add rsp,8

I move the rsp in increments of 8 to ensure that alignment is maintained for the stack. The code assembles ok

The code that is generated by the assembler can be seen by gdb on the MIC

0x0000000000401037 <+65>: sub $0x8,%rsp
0x000000000040103b <+69>: fistpl (%rsp)
=> 0x000000000040103e <+72>: mov 0x4(%rsp),%eax
0x0000000000401042 <+76>: add $0x8,%rsp

it is now loading the eax register 4 on from the rsp

I was able to fix this by changing the source to

sub rsp,8
fistp dword ptr [rsp]
mov eax,dword ptr [rsp]
add rsp,8

but the assembler should either flag the absence of 'ptr' as an error or it should assemble it correctly.

0 Kudos
1 Reply
TaylorIoTKidd
New Contributor I
654 Views

Paul,

Apologies for taking so long to answer this issue, but it got lost. This case is unrelated to the coprocessor. You can report the bug at www.sourceware.org/bugzilla. By the way, our expert doesn't think this is a bug and is done intentionally.

Regards
--
Taylor
 

0 Kudos
Reply