From aeed3004c1ea0a76a8561d3063f750ea2fb206c7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 19 Aug 2009 06:35:36 +0000 Subject: [PATCH] fix asmstreaming of 2/4 byte elements with pow-2 alignments. llvm-svn: 79408 --- lib/MC/MCAsmStreamer.cpp | 9 ++++++++- test/MC/AsmParser/directive_align.s | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index 8068c666671..3dfd8e94748 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -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 // emit alignments as a power of two if possible. 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()) OS << ByteAlignment; diff --git a/test/MC/AsmParser/directive_align.s b/test/MC/AsmParser/directive_align.s index c60be19e452..b381f1e7886 100644 --- a/test/MC/AsmParser/directive_align.s +++ b/test/MC/AsmParser/directive_align.s @@ -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: .p2align 1, 0 +# CHECK: align 1 TEST0: .align 1