Skip to content
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

Add ARM64 encodings for group IF_SVE_CC,CD #99284

Merged
merged 5 commits into from
Mar 8, 2024

Conversation

snickolls-arm
Copy link
Contributor

Add encodings for the insr instruction.

Matching capstone output:

A0393405  insr  z0.b, b13
1D387405  insr  z29.h, h0
E439B405  insr  z4.s, s15
4838F405  insr  z8.d, d2
E43A2405  insr  z4.b, w23
2B386405  insr  z11.h, w1
2E39A405  insr  z14.s, w9
1338E405  insr  z19.d, x0

Contributing towards #94549

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 5, 2024
@ghost
Copy link

ghost commented Mar 5, 2024

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

Add encodings for the insr instruction.

Matching capstone output:

A0393405  insr  z0.b, b13
1D387405  insr  z29.h, h0
E439B405  insr  z4.s, s15
4838F405  insr  z8.d, d2
E43A2405  insr  z4.b, w23
2B386405  insr  z11.h, w1
2E39A405  insr  z14.s, w9
1338E405  insr  z19.d, x0

Contributing towards #94549

Author: snickolls-arm
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@snickolls-arm
Copy link
Contributor Author

@a74nh @kunalspathak @dotnet/arm64-contrib

@kunalspathak kunalspathak added the arm-sve Work related to arm64 SVE/SVE2 support label Mar 5, 2024
INS_OPTS_SCALABLE_D); // INSR <Zdn>.<T>, <V><m>

// IF_SVE_CD_2A
theEmitter->emitIns_R_R(INS_sve_insr, EA_SCALABLE, REG_V4, REG_R23,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per Insr, this also takes ZR register. Can you please add a test for that?

case IF_SVE_CD_2A: // ........xx...... ......mmmmmddddd -- SVE insert general register
assert(insOptsScalable(id->idInsOpt()));
assert(isVectorRegister(id->idReg1())); // ddddd
assert(isGeneralRegister(id->idReg2())); // mmmmm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert(isGeneralRegister(id->idReg2())); // mmmmm
assert(isGeneralRegisterOrZR(id->idReg2())); // mmmmm

@@ -3244,6 +3256,28 @@ static const char * const qRegNames[] =
"q30", "q31"
};

static const char * const dRegNames[] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are already aliased at

REGDEF(V0, 0+VBASE, VMASK(0), "d0", "s0")

// Return value:
// A string that represents a SIMD scalar register name.
//
const char* emitter::emitSimdScalarRegName(regNumber reg, emitAttr attr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
fmt = IF_SVE_CC_2A;
}
else if (isGeneralRegister(reg2))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
else if (isGeneralRegister(reg2))
else if (isGeneralRegisterOrZR(reg2))

//------------------------------------------------------------------------
// emitDispScalarReg: Display a the name of a scalar mode of a vector register
//
void emitter::emitDispScalarReg(regNumber reg, insOpts opt, bool addComma)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty sure there is an existing method that does this.

case IF_SVE_CD_2A: // ........xx...... ......mmmmmddddd -- SVE insert general register
assert(insOptsScalable(id->idInsOpt()));
assert(isVectorRegister(id->idReg1())); // ddddd
assert(isGeneralRegister(id->idReg2())); // mmmmm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For SVE_CD_2A , we should also assert the "width specifier" ( field)

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I can assert this one because it is not passed in as an argument, it is derived from the SVE size. But I have also noticed that it is currently accepting Q size which is invalid and I need to fix this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you should be able to do isValidVectorElemsizeFloat(elemsize)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elemsize can be any of the standard four B,H,S,D sizes (as shown in the <T> table). The same size field is then reused for the general purpose register, as W or X, with W taking up 3 of the values (as shown in the <R> table).
So as long as we assert the B,H,S,D, then the W,X doesn't need checking.

@build-analysis build-analysis bot mentioned this pull request Mar 5, 2024
Copy link
Member

@kunalspathak kunalspathak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@kunalspathak kunalspathak merged commit 80c0df6 into dotnet:main Mar 8, 2024
129 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI arm-sve Work related to arm64 SVE/SVE2 support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants