Skip to content

Add ARM64 encodings for group IF_SVE_CC,CD#99284

Merged
kunalspathak merged 5 commits intodotnet:mainfrom
snickolls-arm:github-IF_SVE_CC,CD
Mar 8, 2024
Merged

Add ARM64 encodings for group IF_SVE_CC,CD#99284
kunalspathak merged 5 commits intodotnet:mainfrom
snickolls-arm:github-IF_SVE_CC,CD

Conversation

@snickolls-arm
Copy link
Copy Markdown
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

@ghost ghost 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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Contributor

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?

Comment thread src/coreclr/jit/emitarm64.cpp Outdated
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
Copy Markdown
Contributor

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

Comment thread src/coreclr/jit/emitarm64.cpp Outdated
"q30", "q31"
};

static const char * const dRegNames[] =
Copy link
Copy Markdown
Contributor

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")

Comment thread src/coreclr/jit/emitarm64.cpp Outdated
// Return value:
// A string that represents a SIMD scalar register name.
//
const char* emitter::emitSimdScalarRegName(regNumber reg, emitAttr attr)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread src/coreclr/jit/emitarm64.cpp Outdated
{
fmt = IF_SVE_CC_2A;
}
else if (isGeneralRegister(reg2))
Copy link
Copy Markdown
Contributor

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))

Comment thread src/coreclr/jit/emitarm64.cpp Outdated
//------------------------------------------------------------------------
// emitDispScalarReg: Display a the name of a scalar mode of a vector register
//
void emitter::emitDispScalarReg(regNumber reg, insOpts opt, bool addComma)
Copy link
Copy Markdown
Contributor

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.

Comment thread src/coreclr/jit/emitarm64.cpp Outdated
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

@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
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 9, 2024
@snickolls-arm snickolls-arm deleted the github-IF_SVE_CC,CD branch January 17, 2025 16:07
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