cmd/internal/obj/loong64: add ROTR, ROTRV instructions support

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

Change-Id: I29adb84eb70bffd963c79ed6957a5197896fb2bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/422316
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Wayne Zuo 2022-08-09 23:08:57 +08:00 committed by David Chase
parent 629ae1cee6
commit 7d574466a9
4 changed files with 25 additions and 1 deletions

View File

@ -41,8 +41,12 @@ lable2:
SRL R4, R5, R6 // a6901700
SRA R4, R5 // a5101800
SRA R4, R5, R6 // a6101800
ROTR R4, R5 // a5101b00
ROTR R4, R5, R6 // a6101b00
SLLV R4, R5 // a5901800
SLLV R4, R5, R6 // a6901800
ROTRV R4, R5 // a5901b00
ROTRV R4, R5, R6 // a6901b00
CLO R4, R5 // 85100000
CLZ R4, R5 // 85140000
ADDF F4, F5 // a5900001
@ -102,8 +106,12 @@ lable2:
SRL $4, R4 // 84904400
SRA $4, R4, R5 // 85904800
SRA $4, R4 // 84904800
ROTR $4, R4, R5 // 85904c00
ROTR $4, R4 // 84904c00
SLLV $4, R4, R5 // 85104100
SLLV $4, R4 // 84104100
ROTRV $4, R4, R5 // 85104d00
ROTRV $4, R4 // 84104d00
SYSCALL // 00002b00
BEQ R4, R5, 1(PC) // 85040058
BEQ R4, 1(PC) // 80040058

View File

@ -335,6 +335,7 @@ const (
ASQRTF
ASRA
ASRL
AROTR
ASUB
ASUBD
ASUBF
@ -362,6 +363,7 @@ const (
ASLLV
ASRAV
ASRLV
AROTRV
ADIVV
ADIVVU

View File

@ -88,6 +88,7 @@ var Anames = []string{
"SQRTF",
"SRA",
"SRL",
"ROTR",
"SUB",
"SUBD",
"SUBF",
@ -107,6 +108,7 @@ var Anames = []string{
"SLLV",
"SRAV",
"SRLV",
"ROTRV",
"DIVV",
"DIVVU",
"REMV",

View File

@ -980,10 +980,12 @@ func buildop(ctxt *obj.Link) {
case ASLL:
opset(ASRL, r0)
opset(ASRA, r0)
opset(AROTR, r0)
case ASLLV:
opset(ASRAV, r0)
opset(ASRLV, r0)
opset(AROTRV, r0)
case ASUB:
opset(ASUBU, r0)
@ -1653,12 +1655,16 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
return 0x2f << 15
case ASRA:
return 0x30 << 15
case AROTR:
return 0x36 << 15
case ASLLV:
return 0x31 << 15
case ASRLV:
return 0x32 << 15
case ASRAV:
return 0x33 << 15
case AROTRV:
return 0x37 << 15
case AADDV:
return 0x21 << 15
case AADDVU:
@ -1845,6 +1851,8 @@ func (c *ctxt0) opirr(a obj.As) uint32 {
return 0x00089 << 15
case ASRA:
return 0x00091 << 15
case AROTR:
return 0x00099 << 15
case AADDV:
return 0x00b << 22
case AADDVU:
@ -1939,6 +1947,9 @@ func (c *ctxt0) opirr(a obj.As) uint32 {
case ASRAV,
-ASRAV:
return 0x0049 << 16
case AROTRV,
-AROTRV:
return 0x004d << 16
case -ALL:
return 0x020 << 24
case -ALLV:
@ -1961,7 +1972,8 @@ func vshift(a obj.As) bool {
switch a {
case ASLLV,
ASRLV,
ASRAV:
ASRAV,
AROTRV:
return true
}
return false