-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[X86] Add USER_MSR instructions. (#68944)
For more details about this instruction, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html
- Loading branch information
1 parent
993e839
commit 819ac45
Showing
34 changed files
with
295 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*===--------------- usermsrintrin.h - USERMSR intrinsics -----------------=== | ||
* | ||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
* See https://llvm.org/LICENSE.txt for license information. | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
* | ||
*===-----------------------------------------------------------------------=== | ||
*/ | ||
#ifndef __X86GPRINTRIN_H | ||
#error "Never use <usermsrintrin.h> directly; include <x86gprintrin.h> instead." | ||
#endif // __X86GPRINTRIN_H | ||
|
||
#ifndef __USERMSRINTRIN_H | ||
#define __USERMSRINTRIN_H | ||
#ifdef __x86_64__ | ||
|
||
static __inline__ unsigned long long | ||
__attribute__((__always_inline__, __nodebug__, __target__("usermsr"))) | ||
_urdmsr(unsigned long long __A) { | ||
return __builtin_ia32_urdmsr(__A); | ||
} | ||
|
||
static __inline__ void | ||
__attribute__((__always_inline__, __nodebug__, __target__("usermsr"))) | ||
_uwrmsr(unsigned long long __A, unsigned long long __B) { | ||
return __builtin_ia32_uwrmsr(__A, __B); | ||
} | ||
|
||
#endif // __x86_64__ | ||
#endif // __USERMSRINTRIN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: %clang_cc1 %s -ffreestanding -triple=i386-unknown-unknown -target-feature +usermsr \ | ||
// RUN: -emit-llvm -fsyntax-only -verify | ||
|
||
#include <x86gprintrin.h> | ||
|
||
unsigned long long test_urdmsr(unsigned long long __A) { | ||
return _urdmsr(__A); // expected-error {{call to undeclared function '_urdmsr'}} | ||
} | ||
|
||
void test_uwrmsr(unsigned long long __A, unsigned long long __B) { | ||
// CHECK-LABEL: @test_uwrmsr( | ||
// CHECK: call void @llvm.x86.uwrmsr( | ||
_uwrmsr(__A, __B); // expected-error {{call to undeclared function '_uwrmsr'}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +usermsr \ | ||
// RUN: -emit-llvm -o - -Wall -Werror -pedantic -Wno-gnu-statement-expression | FileCheck %s | ||
|
||
#include <x86gprintrin.h> | ||
|
||
unsigned long long test_urdmsr(unsigned long long __A) { | ||
// CHECK-LABEL: @test_urdmsr( | ||
// CHECK: call i64 @llvm.x86.urdmsr( | ||
return _urdmsr(__A); | ||
} | ||
|
||
unsigned long long test_urdmsr_const(unsigned long long __A) { | ||
// CHECK-LABEL: @test_urdmsr_const( | ||
// CHECK: call i64 @llvm.x86.urdmsr( | ||
return _urdmsr(123u); | ||
} | ||
|
||
void test_uwrmsr(unsigned long long __A, unsigned long long __B) { | ||
// CHECK-LABEL: @test_uwrmsr( | ||
// CHECK: call void @llvm.x86.uwrmsr( | ||
_uwrmsr(__A, __B); | ||
} | ||
|
||
void test_uwrmsr_const(unsigned long long __A, unsigned long long __B) { | ||
// CHECK-LABEL: @test_uwrmsr_const( | ||
// CHECK: call void @llvm.x86.uwrmsr( | ||
_uwrmsr(123u, __B); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.