Skip to content

Commit

Permalink
[X86][bugfix] redefine __SSC_MARK to escape cpp string literal concat…
Browse files Browse the repository at this point in the history
…enation problem

Reviewed By: pengfei, RKSimon

Differential Revision: https://reviews.llvm.org/D132636
  • Loading branch information
xiangzh1 committed Sep 1, 2022
1 parent 08d9912 commit 2da0df5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions clang/lib/Headers/x86gprintrin.h
Expand Up @@ -26,22 +26,19 @@
#endif

#if defined(__i386__)
#define __FULLBX "ebx"
#define __SAVE_GPRBX "mov {%%ebx, %%eax |eax, ebx};"
#define __RESTORE_GPRBX "mov {%%eax, %%ebx |ebx, eax};"
#define __TMPGPR "eax"
#else
// When in 64-bit target, the 32-bit operands generate a 32-bit result,
// zero-extended to a 64-bit result in the destination general-purpose,
// It means "mov x %ebx" will clobber the higher 32 bits of rbx, so we
// should preserve the 64-bit register rbx.
#define __FULLBX "rbx"
#define __SAVE_GPRBX "mov {%%rbx, %%rax |rax, rbx};"
#define __RESTORE_GPRBX "mov {%%rax, %%rbx |rbx, rax};"
#define __TMPGPR "rax"
#endif

#define __MOVEGPR(__r1, __r2) "mov {%%"__r1 ", %%"__r2 "|"__r2 ", "__r1"};"

#define __SAVE_GPRBX __MOVEGPR(__FULLBX, __TMPGPR)
#define __RESTORE_GPRBX __MOVEGPR(__TMPGPR, __FULLBX)

#define __SSC_MARK(__Tag) \
__asm__ __volatile__( __SAVE_GPRBX \
"mov {%0, %%ebx|ebx, %0}; " \
Expand Down

0 comments on commit 2da0df5

Please sign in to comment.