Skip to content

Commit db07c86

Browse files
sophie-zhaogopherbot
authored andcommitted
cmd/internal/obj/loong64: add support for instructions ANDN and ORN
Go asm syntax: ANDN/ORN RK, RJ, RD or ANDN/ORN RK, RD Equivalent platform assembler syntax: andn/orn rd, rj, rk or andn/orn rd, rd, rk Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html Change-Id: I6d240ecae8f9443811ca450aed3574f13f0f4a81 Reviewed-on: https://go-review.googlesource.com/c/go/+/610475 Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Commit-Queue: abner chenc <[email protected]> Reviewed-by: abner chenc <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: abner chenc <[email protected]>
1 parent 501b389 commit db07c86

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

src/cmd/asm/internal/asm/testdata/loong64enc1.s

+5
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ lable2:
132132
BREAK // 00002a00
133133
UNDEF // 00002a00
134134

135+
ANDN R4, R5, R6 // a6901600
136+
ANDN R4, R5 // a5901600
137+
ORN R4, R5, R6 // a6101600
138+
ORN R4, R5 // a5101600
139+
135140
// mul
136141
MUL R4, R5 // a5101c00
137142
MUL R4, R5, R6 // a6101c00

src/cmd/internal/obj/loong64/a.out.go

+4
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ const (
385385
AMOVVF
386386
AMOVVD
387387

388+
// 2.2.1.8
389+
AORN
390+
AANDN
391+
388392
// 2.2.7. Atomic Memory Access Instructions
389393
AAMSWAPB
390394
AAMSWAPH

src/cmd/internal/obj/loong64/anames.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/internal/obj/loong64/asm.go

+6
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,8 @@ func buildop(ctxt *obj.Link) {
11001100
case AAND:
11011101
opset(AOR, r0)
11021102
opset(AXOR, r0)
1103+
opset(AORN, r0)
1104+
opset(AANDN, r0)
11031105

11041106
case ABEQ:
11051107
opset(ABNE, r0)
@@ -1858,6 +1860,10 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
18581860
return 0x2a << 15
18591861
case AXOR:
18601862
return 0x2b << 15
1863+
case AORN:
1864+
return 0x2c << 15 // orn
1865+
case AANDN:
1866+
return 0x2d << 15 // andn
18611867
case ASUB:
18621868
return 0x22 << 15
18631869
case ASUBU, ANEGW:

0 commit comments

Comments
 (0)