fix(asm): encode the CMOV condition the renderer prints
The renderer spells a conditional move CMOV plus the condition alone (CMOVLE, CMOVG), the width carried by the operand registers, so CMOVLE parsed as the size L and the condition E and encoded CMOVE. A suffix that is itself a condition name now reads as that condition with the width from the destination register, and the Plan 9 size-prefixed spellings keep their parse. Assisted-by: GLM 5.3 Flash
This commit is contained in:
1 parent
11cac26508
commit
abc2d32b83
3 files changed
+64
-30
No files matched your search
+8
-10
@@ -62,16 +62,14 @@ func Encodable(mnemonic string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CMOV carries size then condition (CMOVLGT); SET carries the condition
|
||||
// alone (SETNE). The size letter is checked exactly as encodeCmov does,
|
||||
// so a spelling like CMOVBGT is not reported encodable when Encode
|
||||
// would reject it.
|
||||
if rest, ok := strings.CutPrefix(upper, "CMOV"); ok && len(rest) >= 2 {
|
||||
switch rest[0] {
|
||||
case 'W', 'L', 'Q':
|
||||
if _, ok := jccMap[rest[1:]]; ok {
|
||||
return true
|
||||
}
|
||||
// CMOV carries size then condition (CMOVLGT), or the renderer's
|
||||
// condition alone (CMOVLE) with the width from the operand; SET carries
|
||||
// the condition alone (SETNE). cmovCondition checks the suffix exactly
|
||||
// as encodeCmov does, so a spelling like CMOVBGT is not reported
|
||||
// encodable when Encode would reject it.
|
||||
if rest, ok := strings.CutPrefix(upper, "CMOV"); ok {
|
||||
if _, _, ok := cmovCondition(rest); ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if rest, ok := strings.CutPrefix(upper, "SET"); ok {
|
||||
|
||||
Reference in new issue
Block a user