[PATCH] D108682: [X86] Support __SSC_MARK(const int id) in x86gprintrin.h

Xiang Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 29 17:52:45 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG83e82ff76753: [X86] Support __SSC_MARK(const int id) (authored by xiangzhangllvm).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108682/new/

https://reviews.llvm.org/D108682

Files:
  clang/lib/Headers/x86gprintrin.h
  clang/test/CodeGen/X86/x86-ssc-mark.c


Index: clang/test/CodeGen/X86/x86-ssc-mark.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/X86/x86-ssc-mark.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 %s -triple=x86_64-unknow-unknow -S -ffreestanding -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=i386-unknow-unknow -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);
+}
Index: clang/lib/Headers/x86gprintrin.h
===================================================================
--- clang/lib/Headers/x86gprintrin.h
+++ clang/lib/Headers/x86gprintrin.h
@@ -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 */


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108682.369354.patch
Type: text/x-patch
Size: 1276 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210830/0b8c85cd/attachment.bin>


More information about the cfe-commits mailing list