]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/internal/obj/ppc64: add SETB instruction
authorPaul E. Murphy <murp@ibm.com>
Mon, 27 Feb 2023 22:05:34 +0000 (16:05 -0600)
committerPaul Murphy <murp@ibm.com>
Wed, 8 Mar 2023 14:23:29 +0000 (14:23 +0000)
This ISA 3.0 (power9) instruction is helpful for some string functions
in a future change.

Change-Id: I1a659488ffb5099f8c89f480c39af4ef9c4b556a
Reviewed-on: https://go-review.googlesource.com/c/go/+/472635
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/asm/internal/asm/testdata/ppc64.s
src/cmd/internal/obj/ppc64/a.out.go
src/cmd/internal/obj/ppc64/anames.go
src/cmd/internal/obj/ppc64/asm9.go

index 72ae796018f3378dd7a99e83424c112026fa4eed..7a83fb952bb83e69d6727d3953d25fa52dd78601 100644 (file)
@@ -1087,4 +1087,6 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
        MOVD 4(R1), XER                 // ebe100047fe103a6
        PNOP                            // 0700000000000000
 
+       SETB CR1,R3                     // 7c640100
+
        RET
index 995f9d9b0a183a7cec479b6ea6e58397c059a00d..09b0a87a07531820901c0ba2fa722f91cf154251 100644 (file)
@@ -801,6 +801,7 @@ const (
        AEXTSWSLICC
        ASTDCCC
        ATD
+       ASETB
 
        /* 64-bit pseudo operation */
        ADWORD
index 05014ecfde9016d803921165c4e5776c26b38370..81e1fd1ea42461e67ff7b94aef26a2f2c3c3224a 100644 (file)
@@ -333,6 +333,7 @@ var Anames = []string{
        "EXTSWSLICC",
        "STDCCC",
        "TD",
+       "SETB",
        "DWORD",
        "REMD",
        "REMDU",
index 40258ca0b2b86afd80be49d59b923e2c46e75c0b..799def6ef781a84953a402a6175d79b8cde416d5 100644 (file)
@@ -325,6 +325,9 @@ var optab = []Optab{
        {as: AADDEX, a1: C_REG, a2: C_REG, a3: C_SCON, a6: C_REG, type_: 94, size: 4}, /* add extended using alternate carry, z23-form */
        {as: ACRAND, a1: C_CRBIT, a2: C_CRBIT, a6: C_CRBIT, type_: 2, size: 4},        /* logical ops for condition register bits xl-form */
 
+       /* Misc ISA 3.0 instructions */
+       {as: ASETB, a1: C_CREG, a6: C_REG, type_: 110, size: 4},
+
        /* Vector instructions */
 
        /* Vector load */
@@ -2111,6 +2114,7 @@ func buildop(ctxt *obj.Link) {
                        AMTVSRDD,
                        APNOP,
                        AISEL,
+                       ASETB,
                        obj.ANOP,
                        obj.ATEXT,
                        obj.AUNDEF,
@@ -2335,6 +2339,7 @@ const (
        OP_RLDICL   = 30<<26 | 0<<1 | 0<<10 | 0
        OP_RLDCL    = 30<<26 | 8<<1 | 0<<10 | 0
        OP_EXTSWSLI = 31<<26 | 445<<2
+       OP_SETB     = 31<<26 | 128<<1
 )
 
 func pfxadd(rt, ra int16, r uint32, imm32 int64) (uint32, uint32) {
@@ -3971,6 +3976,11 @@ func asmout(c *ctxt9, p *obj.Prog, o *Optab, out *[5]uint32) {
                o1 = AOP_RRR(c.oploadx(p.As), uint32(p.To.Reg), uint32(p.From.Index), uint32(r))
                // Sign extend MOVB operations. This is ignored for other cases (o.size == 4).
                o2 = LOP_RRR(OP_EXTSB, uint32(p.To.Reg), uint32(p.To.Reg), 0)
+
+       case 110: /* SETB creg, rt */
+               bfa := uint32(p.From.Reg) << 2
+               rt := uint32(p.To.Reg)
+               o1 = LOP_RRR(OP_SETB, bfa, rt, 0)
        }
 
        out[0] = o1