feat(arch): add the imm8 scalar FP16 controls to the amd64 extension layer
Assisted-by: GLM 5.3 Flash
This commit is contained in:
1 parent
0354a1f4c1
commit
aa9c7ca030
4 files changed
+288
-8
No files matched your search
+61
-1
@@ -272,6 +272,16 @@ const (
|
||||
// general-register destination: VMOVW EAX, X1 and VCVTSH2SI EAX, X1.
|
||||
// Operands: src, dest.
|
||||
ExtFormAmdVecGpr
|
||||
// ExtFormAmdVec3Imm is the three-vector form with a control immediate,
|
||||
// VGETMANTSH $11, X28, X29, X30 style: the immediate leads, the order
|
||||
// the reference listings write it in. Operands: imm, src1, src2, dest.
|
||||
// The immediate's layout is named by the entry's Imm8 kind.
|
||||
ExtFormAmdVec3Imm
|
||||
// ExtFormAmdMask2Imm is the opmask-destination form with a control
|
||||
// immediate: VCMPSH $7, X28, X29, K5. Operands: imm, src1, src2, dest,
|
||||
// where dest is an opmask register and the immediate's layout is named
|
||||
// by the entry's Imm8 kind.
|
||||
ExtFormAmdMask2Imm
|
||||
)
|
||||
|
||||
// Arity returns the operand count the form takes.
|
||||
@@ -285,6 +295,8 @@ func (f ExtForm) Arity() int {
|
||||
return 3
|
||||
case ExtFormAmdVec2, ExtFormAmdVec2Half, ExtFormAmdGprVec, ExtFormAmdVecGpr:
|
||||
return 2
|
||||
case ExtFormAmdVec3Imm, ExtFormAmdMask2Imm:
|
||||
return 4
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
@@ -334,6 +346,10 @@ func (f ExtForm) String() string {
|
||||
return "general register, vector"
|
||||
case ExtFormAmdVecGpr:
|
||||
return "vector, general register"
|
||||
case ExtFormAmdVec3Imm:
|
||||
return "immediate, three vectors"
|
||||
case ExtFormAmdMask2Imm:
|
||||
return "immediate, two vectors into an opmask"
|
||||
default:
|
||||
return "unknown form"
|
||||
}
|
||||
@@ -350,6 +366,45 @@ const (
|
||||
ExtFeatureSVE2 ExtFeature = "sve2"
|
||||
)
|
||||
|
||||
// ExtImm8Kind names the imm8-control layout an amd64 extended entry carries
|
||||
// in its immediate operand. The kind drives the validation at encode time:
|
||||
// a value the manual reserves is an error, never a silent mis-encoding.
|
||||
type ExtImm8Kind uint8
|
||||
|
||||
// The imm8-control layouts, ExtImm8None first as the zero value an entry
|
||||
// without an immediate carries.
|
||||
const (
|
||||
// ExtImm8None marks a form that takes no immediate operand.
|
||||
ExtImm8None ExtImm8Kind = iota
|
||||
// ExtImm8ScaleRound is the fraction-bits-plus-round-control layout of
|
||||
// VRNDSCALESH and VREDUCESH: imm8[7:4] carries the number of fraction
|
||||
// bits M, imm8[3] the precision-exception control, imm8[2] the rounding
|
||||
// mode source and imm8[1:0] the rounding mode. Every byte encodes.
|
||||
ExtImm8ScaleRound
|
||||
// ExtImm8GetMant is the mantissa-extraction control of VGETMANTSH:
|
||||
// imm8[3:2] the sign control, imm8[1:0] the normalisation interval,
|
||||
// and imm8[7:4] reserved, which must encode as zero.
|
||||
ExtImm8GetMant
|
||||
// ExtImm8CmpPredicate is the comparison-predicate control of VCMPSH:
|
||||
// imm8[4:0] names one of the 32 predicates and the bits above are
|
||||
// masked away by the hardware, so every byte encodes.
|
||||
ExtImm8CmpPredicate
|
||||
)
|
||||
|
||||
// String returns a short label for the imm8-control layout, for diagnostics.
|
||||
func (k ExtImm8Kind) String() string {
|
||||
switch k {
|
||||
case ExtImm8ScaleRound:
|
||||
return "fraction bits and round control"
|
||||
case ExtImm8GetMant:
|
||||
return "mantissa extraction control"
|
||||
case ExtImm8CmpPredicate:
|
||||
return "comparison predicate"
|
||||
default:
|
||||
return "no immediate"
|
||||
}
|
||||
}
|
||||
|
||||
// ExtInstr is one extended instruction: the metadata a lookup needs and the
|
||||
// encoding as data. Word holds the fixed bits of the 32-bit encoding with
|
||||
// every operand field and the size field zero; the form says which fields the
|
||||
@@ -372,6 +427,10 @@ type ExtInstr struct {
|
||||
// Wig records that the entry ignores the W bit in its general-register
|
||||
// position, so both 32-bit and 64-bit registers encode.
|
||||
Wig bool
|
||||
// Imm8 names the imm8-control layout the amd64 entry's immediate
|
||||
// operand carries, ExtImm8None when the form takes none. The arm64
|
||||
// entries all carry the zero value.
|
||||
Imm8 ExtImm8Kind
|
||||
}
|
||||
|
||||
// Encode assembles the operands into the 4 little-endian bytes of the
|
||||
@@ -393,7 +452,8 @@ func (in ExtInstr) Encode(ops []ExtOperand) ([]byte, error) {
|
||||
case ExtFormSignedImmediate:
|
||||
return in.encodeSignedImmediate(ops)
|
||||
case ExtFormAmdVec3, ExtFormAmdVec2, ExtFormAmdVec2Half, ExtFormAmdMask2,
|
||||
ExtFormAmdVecGprVec, ExtFormAmdGprVec, ExtFormAmdVecGpr:
|
||||
ExtFormAmdVecGprVec, ExtFormAmdGprVec, ExtFormAmdVecGpr,
|
||||
ExtFormAmdVec3Imm, ExtFormAmdMask2Imm:
|
||||
return in.encodeAmd64(ops)
|
||||
default:
|
||||
return nil, fmt.Errorf("%s: unknown form %d", in.Name, in.Form)
|
||||
|
||||
Reference in new issue
Block a user