diff --git a/lib/MC/MCAsmInfo.cpp b/lib/MC/MCAsmInfo.cpp
index c330e74..f807fd9 100644
--- a/lib/MC/MCAsmInfo.cpp
+++ b/lib/MC/MCAsmInfo.cpp
@@ -68,6 +68,7 @@ MCAsmInfo::MCAsmInfo() {
   AlignDirective = "\t.align\t";
   AlignmentIsInBytes = true;
   TextAlignFillValue = 0;
+  CodeAlignDirective = 0;
   GPRel32Directive = 0;
   GlobalDirective = "\t.globl\t";
   HasSetDirective = true;
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp
index d90f7b2..45ccce8 100644
--- a/lib/MC/MCAsmStreamer.cpp
+++ b/lib/MC/MCAsmStreamer.cpp
@@ -733,9 +733,15 @@ void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
 
 void MCAsmStreamer::EmitCodeAlignment(unsigned ByteAlignment,
                                       unsigned MaxBytesToEmit) {
-  // Emit with a text fill value.
-  EmitValueToAlignment(ByteAlignment, MAI.getTextAlignFillValue(),
-                       1, MaxBytesToEmit);
+  if (MAI.getCodeAlignDirective()) {
+    OS << MAI.getCodeAlignDirective();
+    EmitEOL();
+  }
+  else {
+    // Emit with a text fill value.
+    EmitValueToAlignment(ByteAlignment, MAI.getTextAlignFillValue(),
+                         1, MaxBytesToEmit);
+  }
 }
 
 void MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset,
diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h
index d7402b3..72d314f 100644
--- a/include/llvm/MC/MCAsmInfo.h
+++ b/include/llvm/MC/MCAsmInfo.h
@@ -233,6 +233,10 @@ namespace llvm {
     /// space created as the result of a alignment directive.
     unsigned TextAlignFillValue;             // Defaults to 0
 
+    /// CodeAlignDirective - If specified, a separate directive to align the
+    /// instructions.
+    const char *CodeAlignDirective;          // defaults to NULL.
+
     //===--- Global Variable Emission Directives --------------------------===//
 
     /// GlobalDirective - This is the directive used to declare a global entity.
@@ -509,6 +513,9 @@ namespace llvm {
     unsigned getTextAlignFillValue() const {
       return TextAlignFillValue;
     }
+    const char *getCodeAlignDirective() const {
+      return CodeAlignDirective;
+    }
     const char *getGlobalDirective() const {
       return GlobalDirective;
     }
