1

I'm trying to do some code profiling with Intel's IACA. I've used this Stack Overflow question to set up the makers. The problem I'm having is that if I use gcc and compile straight from the source to the binary, I'm fine. The program compiles and IACA works fine. But if I use -S to compile to asm first, and then use gcc on that, I get the following error.

main.c: Assembler messages:
main.c:10: Error: no such instruction: `movl $111,%ebx'
main.c:13: Error: no such instruction: `movl $222,%ebx'

I recognize that these are the instructions that IACA has injected. But I don't know why they are only a problem when I compile to asm first.

The reason I want to do this is I want to be able to use IACA on FORTRAN code, so I am unable to use the c header file. I should be able to place the markers in the asm by hand but I can't compile the code afterwards.

Just to be clear, for the code I've posted here, I only used the header file and got this error. I did not add anything to the asm. Just compiled to asm then to binary.

main.c:

#include "iacaMarks.h"  
int main()
{
  int i = 0;
  float count = 0.0;

  for(i = 0; i < 123; i++){
    IACA_START
    count+=count;
  }
  IACA_END
}

Makefile:

asm:
        gcc -S main.c -I/home/lavin2/iaca-lin64/include/ -masm=intel
final:
        gcc main.s
all:
        gcc main.c -I/home/lavin2/iaca-lin64/include/

make all works fine and then IACA accepts the binary and runs profiling. make asm followed by make final will produce the above error.

I'm running 64-bit Ubuntu 14.10 on an Intel Xeon-2699 and gcc 4.9.1.

Community
  • 1
  • 1
Patrick
  • 51
  • 6
  • 3
    While your gcc command line to create the asm file uses -masm=intel, those error lines are not intel format (they are at&t format). Note that your other gcc command does not specify -masm=intel, which means it uses the default (att). If there is some way to convince IACA to output intel format, that would probably solve your problem. Alternately, try removing the -masm from the gcc line and let it use the att format. – David Wohlferd Jul 01 '15 at 02:47
  • @david Ah okay. That cleared it up. I believe I still have a problem pasting correctly formatted asm directly into the asm generated from the fortran code I have. I thought I had boiled it down to the simple case but it seems I was wrong. That may have to be a separate question. – Patrick Jul 01 '15 at 04:06

0 Answers0