[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
Sun Oct 25 08:36:07 PDT 2015


m_zuckerman added a comment.

This is now the asm output of Darwin   
-cc1 -triple i386-apple-darwin10 -fasm-blocks -mllvm --x86-asm-syntax=intel test.c -S -o test.s
**Input:**

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

**Output:**

          .section        __TEXT,__text,regular,pure_instructions
          .intel_syntax noprefix
          .intel_syntax noprefix
          .globl  _f
          .align  4, 0x90
  _f:
          push    eax
          ## InlineAsm Start
   
          .align  2, 0x90
   
          ## InlineAsm End
          mov     dword ptr [esp], eax
          ## InlineAsm Start
   
          .align  4, 0x90
   
          ## InlineAsm End
          mov     dword ptr [esp], eax
          ## InlineAsm Start
          .align  8, 0x90
          ## InlineAsm End
          ## InlineAsm Start
          .align  16, 0x90
          ## InlineAsm End
          xor     eax, eax
          pop     edx
          ret
   
          .intel_syntax noprefix
          .globl  _main
          .align  4, 0x90
  _main:
          sub     esp, 12
          mov     dword ptr [esp + 8], 0
          call    _f
          add     esp, 12
          ret

All the code is now under Darwin rule.

|                      | **INOUT**         | **OUTPUT** | **Meaning**                                                                     |
| Microsoft            | N=Number          | .align N   | Aligns the next variable or instruction on a byte that is a multiple of number. |
| Darwin               | N = NUMBER 1<N<32 | .align N   | align_expression is a power of 2 (2^N)                                          |
| Other Os Is In Bytes | N=Number          | .align N   | Aligns the next variable or instruction on a byte that is a multiple of number. |


http://reviews.llvm.org/D13869





More information about the llvm-commits mailing list