-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i#2626: Add instructions and feature for AARCH64 FEAT_WFxT (#6842)
Add encoding for the WFIT and WFET instructions. Also add identification of FEAT_WFxT as FEATURE_WFxT. Issue: #2626
- Loading branch information
1 parent
b0aebef
commit fe8809e
Showing
13 changed files
with
259 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# ********************************************************** | ||
# Copyright (c) 2024 ARM Limited. All rights reserved. | ||
# ********************************************************** | ||
|
||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# * Redistributions of source code must retain the above copyright notice, | ||
# this list of conditions and the following disclaimer. | ||
# | ||
# * Redistributions in binary form must reproduce the above copyright notice, | ||
# this list of conditions and the following disclaimer in the documentation | ||
# and/or other materials provided with the distribution. | ||
# | ||
# * Neither the name of ARM Limited nor the names of its contributors may be | ||
# used to endorse or promote products derived from this software without | ||
# specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL ARM LIMITED OR CONTRIBUTORS BE LIABLE | ||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
# DAMAGE. | ||
|
||
# This file defines instruction encodings for v8.7 instructions. | ||
|
||
# See header comments in codec_v80.txt and opnd_defs.txt to understand how | ||
# instructions are defined for the purposes of decode and encode code | ||
# generation. | ||
|
||
# Instruction definitions: | ||
|
||
110101010000001100010000000xxxxx n 1221 WFxT wfet : x0 | ||
110101010000001100010000001xxxxx n 1222 WFxT wfit : x0 |
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,45 @@ | ||
# ********************************************************** | ||
# Copyright (c) 2024 ARM Limited. All rights reserved. | ||
# ********************************************************** | ||
|
||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# * Redistributions of source code must retain the above copyright notice, | ||
# this list of conditions and the following disclaimer. | ||
# | ||
# * Redistributions in binary form must reproduce the above copyright notice, | ||
# this list of conditions and the following disclaimer in the documentation | ||
# and/or other materials provided with the distribution. | ||
# | ||
# * Neither the name of ARM Limited nor the names of its contributors may be | ||
# used to endorse or promote products derived from this software without | ||
# specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL ARM LIMITED OR CONTRIBUTORS BE LIABLE | ||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
# DAMAGE. | ||
|
||
# Test data for DynamoRIO's AArch64 v8.7 encoder, decoder and disassembler. | ||
# See dis-a64-sve.txt for the formatting. | ||
|
||
# Tests: | ||
# WFET <Xt> | ||
d5031000 : wfet x0 : wfet %x0 | ||
d5031002 : wfet x2 : wfet %x2 | ||
d503100A : wfet x10 : wfet %x10 | ||
d503101E : wfet x30 : wfet %x30 | ||
|
||
# WFIT <Xt> | ||
d5031020 : wfit x0 : wfit %x0 | ||
d5031025 : wfit x5 : wfit %x5 | ||
d5031030 : wfit x16 : wfit %x16 | ||
d503103b : wfit x27 : wfit %x27 |
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,91 @@ | ||
/* ********************************************************** | ||
* Copyright (c) 2024 ARM Limited. All rights reserved. | ||
* **********************************************************/ | ||
|
||
/* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* * Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* * Neither the name of ARM Limited nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL ARM LIMITED OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
* DAMAGE. | ||
*/ | ||
|
||
/* Define DR_FAST_IR to verify that everything compiles when we call the inline | ||
* versions of these routines. | ||
*/ | ||
#ifndef STANDALONE_DECODER | ||
# define DR_FAST_IR 1 | ||
#endif | ||
|
||
/* Uses the DR API, using DR as a standalone library, rather than | ||
* being a client library working with DR on a target program. | ||
*/ | ||
|
||
#include "configure.h" | ||
#include "dr_api.h" | ||
#include "tools.h" | ||
|
||
#include "ir_aarch64.h" | ||
|
||
TEST_INSTR(wfet) | ||
{ | ||
/* Testing WFET <Xt> */ | ||
const char *const expected_0_0[6] = { "wfet %x0", "wfet %x5", "wfet %x10", | ||
"wfet %x15", "wfet %x20", "wfet %x30" }; | ||
TEST_LOOP(wfet, wfet, 6, expected_0_0[i], opnd_create_reg(Xn_six_offset_0[i])); | ||
} | ||
|
||
TEST_INSTR(wfit) | ||
{ | ||
/* Testing WFIT <Xt> */ | ||
const char *const expected_0_0[6] = { "wfit %x0", "wfit %x5", "wfit %x10", | ||
"wfit %x15", "wfit %x20", "wfit %x30" }; | ||
TEST_LOOP(wfit, wfit, 6, expected_0_0[i], opnd_create_reg(Xn_six_offset_0[i])); | ||
} | ||
|
||
int | ||
main(int argc, char *argv[]) | ||
{ | ||
#ifdef STANDALONE_DECODER | ||
void *dcontext = GLOBAL_DCONTEXT; | ||
#else | ||
void *dcontext = dr_standalone_init(); | ||
#endif | ||
bool result = true; | ||
bool test_result; | ||
instr_t *instr; | ||
|
||
enable_all_test_cpu_features(); | ||
|
||
/* FEAT_WFxT */ | ||
RUN_INSTR_TEST(wfet); | ||
RUN_INSTR_TEST(wfit); | ||
|
||
print("All v8.7 tests complete.\n"); | ||
#ifndef STANDALONE_DECODER | ||
dr_standalone_exit(); | ||
#endif | ||
if (result) | ||
return 0; | ||
return 1; | ||
} |
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 @@ | ||
All v8.7 tests complete. |