Min-Yih Hsu 6685a3f3e4 [cfe] Support target-specific escaped character in inline asm
GCC allows each target to define a set of non-letter and non-digit
escaped characters for inline assembly that will be replaced by another
string (They call this "punctuation" characters. The existing "%%" and
"%{" -- replaced by '%' and '{' at the end -- can be seen as special
cases shared by all targets).
This patch implements this feature by adding a new hook in `TargetInfo`.

Differential Revision: https://reviews.llvm.org/D103036
2021-05-24 21:39:21 -07:00

22 lines
560 B
C

// REQUIRES: m68k-registered-target
// RUN: %clang -target m68k -S %s -o - | FileCheck %s
// Test special escaped character in inline assembly
void escaped() {
// '.' -> '.'
// CHECK: move.l #66, %d1
__asm__ ("move%.l #66, %%d1" ::);
// '#' -> '#'
// CHECK: move.l #66, %d1
__asm__ ("move.l %#66, %%d1" ::);
// '/' -> '%'
// CHECK: move.l #66, %d1
__asm__ ("move.l #66, %/d1" ::);
// '$' -> 's'
// CHECK: muls %d0, %d1
__asm__ ("mul%$ %%d0, %%d1" ::);
// '&' -> 'd'
// CHECK: move.l %d0, %d1
__asm__ ("move.l %%%&0, %%d1" ::);
}