cmd/asm: add RDTIME{L,H}.W, RDTIME.D support for loong64

Instruction formats: rdtime rd, rj

The RDTIME family of instructions are used to read constant frequency timer
information, the stable counter value is written into the general register
rd, and the counter id information is written into the general register rj.
(Note: both of its register operands are outputs).

Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: Ida5bbb28316ef70b5f616dac3e6fa6f2e77875b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/421655
Reviewed-by: xiaodong liu <teaofmoli@gmail.com>
Reviewed-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
This commit is contained in:
Guoqi Chen 2022-08-04 18:13:59 +08:00 committed by Wayne Zuo
parent a432d89137
commit bf8d142b4e
7 changed files with 338 additions and 275 deletions

View file

@ -202,6 +202,7 @@ func (p *Prog) WriteInstructionString(w io.Writer) {
if p.To.Type != TYPE_NONE {
io.WriteString(w, sep)
WriteDconv(w, p, &p.To)
sep = ", "
}
if p.RegTo2 != REG_NONE {
fmt.Fprintf(w, "%s%v", sep, Rconv(int(p.RegTo2)))