-
Notifications
You must be signed in to change notification settings - Fork 14.3k
__sys builtin support #145079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AdamGlass
wants to merge
2
commits into
llvm:main
Choose a base branch
from
AdamGlass:sys-builtin-clean
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
__sys builtin support #145079
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,68 @@ | ||
// REQUIRES: aarch64-registered-target | ||
|
||
// RUN: %clang_cc1 -triple arm64-windows -fms-compatibility -S \ | ||
// RUN: -o - %s | FileCheck %s -check-prefix CHECK-ASM | ||
|
||
// RUN: %clang_cc1 -triple arm64-darwin -fms-compatibility -S \ | ||
// RUN: -o - %s | FileCheck %s -check-prefix CHECK-ASM | ||
|
||
// RUN: %clang_cc1 -triple arm64-windows -fms-compatibility -emit-llvm \ | ||
// RUN: -o - %s | FileCheck %s -check-prefix CHECK-IR | ||
|
||
// RUN: %clang_cc1 -triple arm64-darwin -fms-compatibility -emit-llvm \ | ||
// RUN: -o - %s | FileCheck %s -check-prefix CHECK-IR | ||
|
||
// From winnt.h | ||
// op0=1 encodings, use with __sys | ||
#define ARM64_SYSINSTR(op0, op1, crn, crm, op2) \ | ||
( ((op1 & 7) << 11) | \ | ||
((crn & 15) << 7) | \ | ||
((crm & 15) << 3) | \ | ||
((op2 & 7) << 0) ) | ||
|
||
// | ||
// Sampling of instructions | ||
// | ||
#define ARM64_DC_CGDSW_EL1 ARM64_SYSINSTR(1,0, 7,10,6) // Clean of Data and Allocation Tags by Set/Way | ||
#define ARM64_IC_IALLU_EL1 ARM64_SYSINSTR(1,0, 7, 5,0) // Instruction Cache Invalidate All to PoU | ||
#define ARM64_AT_S1E2W ARM64_SYSINSTR(1,4, 7, 8,1) // Translate Stage1, EL2, write | ||
#define ARM64_TLBI_VMALLE1 ARM64_SYSINSTR(1,0, 8, 7,0) // Invalidate stage 1 TLB [CP15_TLBIALL] | ||
#define ARM64_CFP_RCTX ARM64_SYSINSTR(1,3, 7, 3,4) // Control Flow Prediction Restriction by Context | ||
|
||
// From intrin.h | ||
unsigned int __sys(int, __int64); | ||
|
||
void check__sys(__int64 v) { | ||
__int64 ret; | ||
|
||
__sys(ARM64_DC_CGDSW_EL1, v); | ||
// CHECK-ASM: msr S1_0_C7_C10_6, x8 | ||
// CHECK-IR: %[[VAR:.*]] = load i64, | ||
// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD2:.*]], i64 %[[VAR]]) | ||
|
||
__sys(ARM64_IC_IALLU_EL1, v); | ||
// CHECK-ASM: msr S1_0_C7_C5_0, x8 | ||
// CHECK-IR: %[[VAR:.*]] = load i64, | ||
// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD3:.*]], i64 %[[VAR]]) | ||
|
||
__sys(ARM64_AT_S1E2W, v); | ||
// CHECK-ASM: msr S1_4_C7_C8_1, x8 | ||
// CHECK-IR: %[[VAR:.*]] = load i64, | ||
// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD4:.*]], i64 %[[VAR]]) | ||
|
||
__sys(ARM64_TLBI_VMALLE1, v); | ||
// CHECK-ASM: msr S1_0_C8_C7_0, x8 | ||
// CHECK-IR: %[[VAR:.*]] = load i64, | ||
// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD5:.*]], i64 %[[VAR]]) | ||
|
||
__sys(ARM64_CFP_RCTX, v); | ||
// CHECK-ASM: msr S1_3_C7_C3_4, x8 | ||
// CHECK-IR: %[[VAR:.*]] = load i64, | ||
// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD6:.*]], i64 %[[VAR]]) | ||
} | ||
|
||
// CHECK-IR: ![[MD2]] = !{!"1:0:7:10:6"} | ||
// CHECK-IR: ![[MD3]] = !{!"1:0:7:5:0"} | ||
// CHECK-IR: ![[MD4]] = !{!"1:4:7:8:1"} | ||
// CHECK-IR: ![[MD5]] = !{!"1:0:8:7:0"} | ||
// CHECK-IR: ![[MD6]] = !{!"1:3:7:3:4"} |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.