Skip to content

Commit

Permalink
[X86] Support __SSC_MARK(const int id)
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D108682
  • Loading branch information
xiangzh1 committed Aug 30, 2021
1 parent 4c29dc1 commit 80f7ce8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clang/lib/Headers/x86gprintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@
#include <uintrintrin.h>
#endif

#define __SSC_MARK(Tag) \
__asm__ __volatile__("movl %%ebx, %%eax; movl %0, %%ebx; .byte 0x64, 0x67, " \
"0x90; movl %%eax, %%ebx;" ::"i"(Tag) \
: "%eax");

#endif /* __X86GPRINTRIN_H */
20 changes: 20 additions & 0 deletions clang/test/CodeGen/X86/x86-ssc-mark.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -triple=x86_64-unknown-unknown -S -ffreestanding -o - | FileCheck %s
// RUN: %clang_cc1 %s -triple=i386-unknown-unknown -S -ffreestanding -o - | FileCheck %s

#include <immintrin.h>

// The ebx may be use for base pointer, we need to restore it in time.
void ssc_mark() {
// CHECK-LABEL: ssc_mark
// CHECK: #APP
// CHECK: movl %ebx, %eax
// CHECK: movl $0, %ebx
// CHECK: .byte 100
// CHECK: .byte 103
// CHECK: .byte 144
// CHECK: movl %eax, %ebx
// CHECK: #NO_APP

__SSC_MARK(0x0);
}

0 comments on commit 80f7ce8

Please sign in to comment.