feat(asm): encode the riscv64 quad-precision family and fix the fp cvt paths
Assisted-by: GLM 5.3 Flash
This commit is contained in:
1 parent
955bc6643e
commit
9b751f6e58
4 files changed
+331
-50
No files matched your search
+10
-6
@@ -1368,7 +1368,7 @@ func encodeRISCVInstr(instr *ast.Instr, pc int, offsets map[string]int, fi riscv
|
||||
|
||||
// FP conversions with an explicit rounding mode: FCVTWS.RNE and friends
|
||||
// suffix the base mnemonic with RNE/RTZ/RDN/RUP/RMM, which lands in the
|
||||
// low three bits of the funct7 field.
|
||||
// funct3 field, replacing the bare form's default.
|
||||
if i := strings.IndexByte(mnem, '.'); i > 0 {
|
||||
if base, ok := riscvCvtTable[mnem[:i]]; ok {
|
||||
rm, ok := riscvRoundModes[mnem[i+1:]]
|
||||
@@ -1383,7 +1383,7 @@ func encodeRISCVInstr(instr *ast.Instr, pc int, offsets map[string]int, fi riscv
|
||||
if rd < 0 || rs1 < 0 {
|
||||
return nil, fmt.Errorf("invalid operand in %s", mnem)
|
||||
}
|
||||
base.funct7 = (base.funct7 &^ 7) | rm
|
||||
base.funct3 = uint32(rm)
|
||||
word := riscvCvtType(base, rd, rs1)
|
||||
return []byte{byte(word), byte(word >> 8), byte(word >> 16), byte(word >> 24)}, nil
|
||||
}
|
||||
@@ -4653,18 +4653,21 @@ func isFPArithInstr(m string) bool {
|
||||
case "FADDS", "FSUBS", "FMULS", "FDIVS",
|
||||
"FADDD", "FSUBD", "FMULD", "FDIVD",
|
||||
"FSQRTS", "FSQRTD", "FMINS", "FMAXS", "FMIND", "FMAXD", "FSGNJD",
|
||||
"FSGNJS", "FSGNJX", "FSGNJXD", "FSGNJXS", "FSGNJND", "FSGNJNS", "FSGNJNX":
|
||||
"FSGNJS", "FSGNJXD", "FSGNJXS", "FSGNJND", "FSGNJNS",
|
||||
"FADDQ", "FSUBQ", "FMULQ", "FDIVQ",
|
||||
"FSQRTQ", "FMINQ", "FMAXQ", "FSGNJQ",
|
||||
"FSGNJXQ", "FSGNJNQ":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func isFPLoadInstr(m string) bool {
|
||||
return m == "FLW" || m == "FLD"
|
||||
return m == "FLW" || m == "FLD" || m == "FLQ"
|
||||
}
|
||||
|
||||
func isFPStoreInstr(m string) bool {
|
||||
return m == "FSW" || m == "FSD"
|
||||
return m == "FSW" || m == "FSD" || m == "FSQ"
|
||||
}
|
||||
|
||||
func isLRInstr(m string) bool {
|
||||
@@ -4677,7 +4680,8 @@ func isSCInstr(m string) bool {
|
||||
|
||||
func isFPCmpInstr(m string) bool {
|
||||
switch m {
|
||||
case "FEQS", "FLTS", "FLES", "FEQD", "FLTD", "FLED":
|
||||
case "FEQS", "FLTS", "FLES", "FEQD", "FLTD", "FLED",
|
||||
"FEQQ", "FLTQ", "FLEQ":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in new issue
Block a user