diff options
author | Michael Zuckerman <Michael.zuckerman@intel.com> | 2016-10-31 15:27:54 +0000 |
---|---|---|
committer | Michael Zuckerman <Michael.zuckerman@intel.com> | 2016-10-31 15:27:54 +0000 |
commit | 7d991e7a4faf7ef469f01314a86bc2d6fe9dc511 (patch) | |
tree | e3d5eaddf159050230fd2f2ba0b68b2e1cb84817 /lib/AST/Stmt.cpp | |
parent | aa2d2f8af67d7f43f18374ee10bdf5d1a363e9bc (diff) |
[x86][inline-asm] Add support for curly brackets escape using "%" in extended inline asm.
Commit on behalf of mharoush
After LGTM and check all:
This patch is a compatibility fix for clang, matching GCC support for charter escape when using extended in-line assembly (i.e, "%{" ,"%}" --> "{" ,"}" ).
It is meant to enable support for advanced features such as AVX512 conditional\masked vector instructions/broadcast assembly syntax.
Reviewer: 1. rnk
Differential Revision: https://reviews.llvm.org/D25012
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285585 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Stmt.cpp')
-rw-r--r-- | lib/AST/Stmt.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index 89fbdf9d58..697cdc3fb3 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -533,15 +533,17 @@ unsigned GCCAsmStmt::AnalyzeAsmString(SmallVectorImpl<AsmStringPiece>&Pieces, DiagOffs = CurPtr-StrStart-1; return diag::err_asm_invalid_escape; } - + // Handle escaped char and continue looping over the asm string. char EscapedChar = *CurPtr++; - if (EscapedChar == '%') { // %% -> % - // Escaped percentage sign. - CurStringPiece += '%'; + switch (EscapedChar) { + default: + break; + case '%': // %% -> % + case '{': // %{ -> { + case '}': // %} -> } + CurStringPiece += EscapedChar; continue; - } - - if (EscapedChar == '=') { // %= -> Generate an unique ID. + case '=': // %= -> Generate a unique ID. CurStringPiece += "${:uid}"; continue; } |