-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Arm64/SVE: Add insEncodeReg* methods #95105
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,14 +316,59 @@ static code_t insEncodeReg_Vm(regNumber reg); | |
// Returns an encoding for the specified register used in the 'Va' position | ||
static code_t insEncodeReg_Va(regNumber reg); | ||
|
||
// Returns an encoding for the specified register used in the 'Pd' position | ||
static code_t insEncodeReg_Pd(regNumber reg); | ||
// Return an encoding for the specified register used in '4' thru '0' position. | ||
kunalspathak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
static code_t insEncodeReg_V_4_to_0(regNumber reg); | ||
|
||
// Returns an encoding for the specified register used in the 'Pn' position | ||
static code_t insEncodeReg_Pn(regNumber reg); | ||
// Return an encoding for the specified register used in '9' thru '5' position. | ||
static code_t insEncodeReg_V_9_to_5(regNumber reg); | ||
|
||
// Returns an encoding for the specified register used in the 'Pm' position | ||
static code_t insEncodeReg_Pm(regNumber reg); | ||
// Return an encoding for the specified register used in '12' thru '10' position. | ||
static code_t insEncodeReg_P_12_to_10(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '21' thru '17' position. | ||
static code_t insEncodeReg_V_21_to_17(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '21' thru '17' position. | ||
static code_t insEncodeReg_R_21_to_17(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '9' thru '5' position. | ||
static code_t insEncodeReg_R_9_to_5(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '4' thru '0' position. | ||
static code_t insEncodeReg_R_4_to_0(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '20' thru '17' position. | ||
static code_t insEncodeReg_P_20_to_17(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '3' thru '0' position. | ||
static code_t insEncodeReg_P_3_to_0(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '8' thru '5' position. | ||
static code_t insEncodeReg_P_8_to_5(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '13' thru '10' position. | ||
static code_t insEncodeReg_P_13_to_10(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '18' thru '17' position. | ||
static code_t insEncodeReg_R_18_to_17(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '7' thru '5' position. | ||
static code_t insEncodeReg_P_7_to_5(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '3' thru '1' position. | ||
static code_t insEncodeReg_P_3_to_1(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '2' thru '0' position. | ||
static code_t insEncodeReg_P_2_to_0(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '19' thru '17' position. | ||
static code_t insEncodeReg_V_19_to_17(regNumber reg); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should all the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't introduced any "Z" terminology except for displaying the disassembly so kept it as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My preference would be Z, and introduce There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done for #95129 |
||
|
||
// Return an encoding for the specified register used in '20' thru '17' position. | ||
static code_t insEncodeReg_V_20_to_17(regNumber reg); | ||
|
||
// Return an encoding for the specified register used in '9' thru '6' position. | ||
static code_t insEncodeReg_V_9_to_6(regNumber reg); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, you already have 9_to_5. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I search for case IF_SVE_HG_2A: // ................ ......nnnn.ddddd -- SVE2 FP8 downconverts
code = emitInsCodeSve(ins, fmt);
code |= insEncodeReg_V_4_to_0(id->idReg10()); // ddddd
code |= insEncodeReg_V_9_to_6(id->idReg20()); // nnnn
dst += emitOutput_Instr(dst, code);
break;
case IF_SVE_GA_2A: // ............iiii ......nnnn.ddddd -- SME2 multi-vec shift narrow
code = emitInsCodeSve(ins, fmt);
code |= insEncodeReg_V_4_to_0(id->idReg10()); // ddddd
code |= insEncodeReg_V_9_to_6(id->idReg20()); // nnnn
code |= insEncodeImm(); // iiii
dst += emitOutput_Instr(dst, code);
break; Then, searching for // enum name info SVE_HG_2A
INST1(bfcvtn, "bfcvtn", 0, IF_SVE_HG_2A, 0x650A3800 )
// BFCVTN <Zd>.B, {<Zn1>.H-<Zn2>.H } SVE_HG_2A 0110010100001010 001110nnnn0ddddd 650A 3800
// enum name info SVE_GA_2A
INST1(sqrshrn, "sqrshrn", RSH, IF_SVE_GA_2A, 0x45B02800 )
// SQRSHRN <Zd>.H, {<Zn1>.S-<Zn2>.S }, #<const> SVE_GA_2A 010001011011iiii 001010nnnn0ddddd 45B0 2800
Most likely the SVE2 instructions takes only 4 bits for Z registers. Also it seems that https://docsmirror.github.io/A64/2023-06/sveindex.html doesn't have SVE2 instructions. I didn't find an entry of "bfcvtn" in there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, looks like this is similar to the instructions that only allow predicate registers 0 to 7. |
||
|
||
// Returns an encoding for the imm which represents the condition code. | ||
static code_t insEncodeCond(insCond cond); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to change this to
insEncodeReg_V_9_to_5(regNumber reg, int lowbit, int highbit)
But your way is safer.
At the risk of making more hard to parse macros:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BruceForstall - any preference? if we don't want to use macro, we can also convert in a function that takes
lowbit
as a parameter.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some of the predicate ones, I've had to change them to assert(isLowPredicateRegister(reg)); because they only have 4 bits, as opposed to 5 bits.
So, maybe better leaving as functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer functions, even if they are quite duplicative. Makes for easier debugging. Sounds like @a74nh already found reasons the asserts would be different.