This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ARM: gcc generates two identical strd instructions to store 8 bytes


Hi all,

I am using the gcc ARM cross-compiler (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)). Compiling the test.c code (in attachement) with:

'arm-linux-gnueabi-gcc -S test.c'

I obtain the test.s assembly code (in attachement). At lines 56 and 57 of the test.s there is two identical strd instructions:

56	strd	r2, [r7]
57	strd	r2, [r7]

I have checked the semantic of the ARM strd instruction and I have not seen any side effect of this instruction that could explain why gcc need to put this instruction two times in a row. For me, one is sufficient to store the 8-bytes variable into memory.

Is there an explanation?

Thanks.

NathanaÃl PrÃmillieu
#include <stdlib.h>
#include <stdio.h>

int main()
{
  int a = rand();
  long long int b = rand();
  if(a % 2)
    {
      b *= 999;
    }
  printf("%lld\n", b);
}

Attachment: test.s
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]