summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorMichael Zuckerman <Michael.zuckerman@intel.com>2016-10-31 15:27:54 +0000
committerMichael Zuckerman <Michael.zuckerman@intel.com>2016-10-31 15:27:54 +0000
commit2460bada567e0bb9213640d53f417dfd4e23a954 (patch)
tree8bf7f492b5076e2fc4c855ce3198ca3a9f47c453 /clang/lib
parenta7eebeb156220ba889869756513a8c9e02b4ea85 (diff)
downloadbcm5719-llvm-2460bada567e0bb9213640d53f417dfd4e23a954.tar.gz
bcm5719-llvm-2460bada567e0bb9213640d53f417dfd4e23a954.zip
[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 llvm-svn: 285585
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Stmt.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp
index 89fbdf9d589..697cdc3fb36 100644
--- a/clang/lib/AST/Stmt.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud