]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: optimize some patterns into revb2h/revb4h instruction on loong64
authorXiaolin Zhao <zhaoxiaolin@loongson.cn>
Fri, 15 Aug 2025 08:19:01 +0000 (16:19 +0800)
committerGopher Robot <gobot@golang.org>
Thu, 21 Aug 2025 18:19:34 +0000 (11:19 -0700)
commit9632ba8160dd93107af3577334bcadfe40068e42
treef90ac24a9c13f3551399ceb0f49dd051180174ff
parent8dcab6f4505d198b5609182b4b5928bd190b21a8
cmd/compile: optimize some patterns into revb2h/revb4h instruction on loong64

Pattern1: (the type of c is uint16)
    c>>8 | c<<8
To:
    revb2h c

Pattern2: (the type of c is uint32)
    (c & 0xff00ff00)>>8 | (c & 0x00ff00ff)<<8
To:
    revb2h c

Pattern3: (the type of c is uint64)
    (c & 0xff00ff00ff00ff00)>>8 | (c & 0x00ff00ff00ff00ff)<<8
To:
    revb4h c

Change-Id: Ic6231a3f476cbacbea4bd00e31193d107cb86cda
Reviewed-on: https://go-review.googlesource.com/c/go/+/696335
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/compile/internal/loong64/ssa.go
src/cmd/compile/internal/ssa/_gen/LOONG64.rules
src/cmd/compile/internal/ssa/_gen/LOONG64Ops.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/rewriteLOONG64.go
test/codegen/bitfield.go