1
0
mirror of https://github.com/golang/go synced 2024-11-24 05:40:15 -07:00

cmd/internal/obj/riscv: fix illegal form of MOV instructions

This commit is contained in:
Ben Shi 2022-03-31 14:28:08 +00:00
parent 821420d6bb
commit 2b25aaa0ed
2 changed files with 9 additions and 0 deletions

View File

@ -22,5 +22,9 @@ TEXT errors(SB),$0
MOVBU X5, (X6) // ERROR "unsupported unsigned store"
MOVHU X5, (X6) // ERROR "unsupported unsigned store"
MOVWU X5, (X6) // ERROR "unsupported unsigned store"
MOVF F0, F1, F2 // ERROR "illegal MOV instruction"
MOVD F0, F1, F2 // ERROR "illegal MOV instruction"
MOV X10, X11, X12 // ERROR "illegal MOV instruction"
MOVW X10, X11, X12 // ERROR "illegal MOV instruction"
RET

View File

@ -1806,6 +1806,11 @@ func instructionsForMOV(p *obj.Prog) []*instruction {
ins := instructionForProg(p)
inss := []*instruction{ins}
if p.Reg != 0 {
p.Ctxt.Diag("%v: illegal MOV instruction", p)
return nil
}
switch {
case p.From.Type == obj.TYPE_CONST && p.To.Type == obj.TYPE_REG:
// Handle constant to register moves.