fix asmstreaming of 2/4 byte elements with pow-2 alignments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79408 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-08-19 06:35:36 +00:00
parent 3417e8f185
commit 6e579c6727
2 changed files with 10 additions and 3 deletions

View File

@ -229,7 +229,14 @@ void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
// Some assemblers don't support non-power of two alignments, so we always // Some assemblers don't support non-power of two alignments, so we always
// emit alignments as a power of two if possible. // emit alignments as a power of two if possible.
if (isPowerOf2_32(ByteAlignment)) { if (isPowerOf2_32(ByteAlignment)) {
OS << TAI.getAlignDirective(); switch (ValueSize) {
default: llvm_unreachable("Invalid size for machine code value!");
case 1: OS << TAI.getAlignDirective(); break;
// FIXME: use TAI for this!
case 2: OS << ".p2alignw "; break;
case 4: OS << ".p2alignl "; break;
case 8: llvm_unreachable("Unsupported alignment size!");
}
if (TAI.getAlignmentIsInBytes()) if (TAI.getAlignmentIsInBytes())
OS << ByteAlignment; OS << ByteAlignment;

View File

@ -1,7 +1,7 @@
# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s # RUN: llvm-mc -triple i386-apple-darwin9 %s | FileCheck %s
# CHECK: TEST0: # CHECK: TEST0:
# CHECK: .p2align 1, 0 # CHECK: align 1
TEST0: TEST0:
.align 1 .align 1