]> granicus.if.org Git - clang/commit
[x86][CET] Introduce _get_ssp, _inc_ssp intrinsics
authorAlexander Ivchenko <alexander.ivchenko@intel.com>
Mon, 5 Mar 2018 11:30:28 +0000 (11:30 +0000)
committerAlexander Ivchenko <alexander.ivchenko@intel.com>
Mon, 5 Mar 2018 11:30:28 +0000 (11:30 +0000)
commit26d4516ed3de4e70527ed6dd1b122ff03a3a7ba5
treec8d8b673649b0c12089fc8e61f531ac2a6622d7d
parentc16b82c59e482b89c42a456982335f71aece84cb
[x86][CET] Introduce _get_ssp, _inc_ssp intrinsics

Summary:
The _get_ssp intrinsic can be used to retrieve the
shadow stack pointer, independent of the current arch -- in
contract with the rdsspd and the rdsspq intrinsics.
Also, this intrinsic returns zero on CPUs which don't
support CET. The rdssp[d|q] instruction is decoded as nop,
essentially just returning the input operand, which is zero.
Example result of compilation:

```
xorl    %eax, %eax
movl    %eax, %ecx
rdsspq  %rcx         # NOP when CET is not supported
movq    %rcx, %rax   # return zero
```

Reviewers: craig.topper

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D43814

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326689 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Headers/cetintrin.h
test/CodeGen/cetintrin.c