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

@ -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