This revision was automatically updated to reflect the committed changes. Closed by commit rL285585: [x86][inline-asm] Add support for curly brackets escape using "%" in extended… (authored by mzuckerm).
Changed prior to commit: https://reviews.llvm.org/D25012?vs=73602&id=76415#toc Repository: rL LLVM https://reviews.llvm.org/D25012 Files: cfe/trunk/lib/AST/Stmt.cpp cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c Index: cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c =================================================================== --- cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c +++ cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -O0 -S -emit-llvm -o - -Wall -Werror | FileCheck %s +// This test checks validity of inline assembly using curly brackets syntax +// for extended inline asm. + +void test_curly_brackets() { + //CHECK: %xmm1,%xmm0,%xmm1 {%k1}{z} + asm("vpaddb\t %%xmm1,%%xmm0,%%xmm1 %{%%k1%}%{z%}\t":::); +} \ No newline at end of file Index: cfe/trunk/lib/AST/Stmt.cpp =================================================================== --- cfe/trunk/lib/AST/Stmt.cpp +++ cfe/trunk/lib/AST/Stmt.cpp @@ -533,15 +533,17 @@ 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; }
Index: cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c =================================================================== --- cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c +++ cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -O0 -S -emit-llvm -o - -Wall -Werror | FileCheck %s +// This test checks validity of inline assembly using curly brackets syntax +// for extended inline asm. + +void test_curly_brackets() { + //CHECK: %xmm1,%xmm0,%xmm1 {%k1}{z} + asm("vpaddb\t %%xmm1,%%xmm0,%%xmm1 %{%%k1%}%{z%}\t":::); +} \ No newline at end of file Index: cfe/trunk/lib/AST/Stmt.cpp =================================================================== --- cfe/trunk/lib/AST/Stmt.cpp +++ cfe/trunk/lib/AST/Stmt.cpp @@ -533,15 +533,17 @@ 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; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits