mirror of
https://github.com/golang/go
synced 2024-11-24 05:20:04 -07:00
cmd/internal/obj/riscv: fix illegal form of MOV instructions
The MOV like instructions should only have two operands.
Change-Id: Icbfb49e47a91ac305194c2f140d3d81c912f6d6d
GitHub-Last-Rev: 2b25aaa0ed
GitHub-Pull-Request: golang/go#52073
Reviewed-on: https://go-review.googlesource.com/c/go/+/397175
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: mzh <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
baf6df06c0
commit
5dbfa6e61a
@ -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
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user