[PATCH] D13869: instruction 'align' in asm blocks works incorrectly with some cases of parameters

michael zuckerman via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 00:43:12 PDT 2015


m_zuckerman added a comment.

let say we running this test (I run the test without any change on the code) .  
-cc1 -triple i386-apple-darwin10  -fasm-blocks -mllvm --x86-asm-syntax=intel test.c -S -o  test.s

**TEST**

  int f(void)
  {
      asm { align 2 }
      asm { align 4 }
      asm ( ".align 8 ");
      asm ( ".align 16" );
  
      return 0;
  }
  
  int main()
  {
      return f();
  }

Half in Microsoft style and half in Darwin/at&t. 
Which of the syntax we will choose ?
I say that the programmer want to create code in Microsoft style in the first two lines. This is the only way he can enter to the AsmParser::parseDirectiveMSAlign . He want it in Microsoft style not Darwin. 
The last two lines are under Darwin path.

**OUTPUT**

1. .section	__TEXT,__text,regular,pure_instructions
2. .macosx_version_min 10, 0
3. .intel_syntax noprefix
4. .globl	_f
5. .align	4, 0x90
6. _f:
7. push	eax
8. ## InlineAsm Start
9.
10. .align	1, 0x90
11.
12. ## InlineAsm End
13. mov	dword ptr [esp], eax
14. ## InlineAsm Start
15.
16. .align	2, 0x90
17.
18. ## InlineAsm End
19. mov	dword ptr [esp], eax
20. ## InlineAsm Start
21. .align	8, 0x90
22. ## InlineAsm End
23. ## InlineAsm Start
24. .align	16, 0x90
25. ## InlineAsm End
26. xor	eax, eax
27. pop	edx
28. ret
29.
30. .globl	_main
31. .align	4, 0x90
32. _main:
33. sub	esp, 12
34. mov	dword ptr [esp + 8], 0
35. call	_f
36. add	esp, 12
37. ret
38. .subsections_via_symbols


http://reviews.llvm.org/D13869





More information about the llvm-commits mailing list