]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/asm, cmd/internal/obj/riscv: fix branch pseudo-instructions
authorQuey-Liang Kao <s101062801@m101.nthu.edu.tw>
Sat, 21 Nov 2020 14:48:55 +0000 (22:48 +0800)
committerJoel Sing <joel@sing.id.au>
Wed, 2 Dec 2020 14:20:12 +0000 (14:20 +0000)
commit0433845ad18a355413033bb3495ba3195f4c69ec
tree7b7cde1a9da6ef75ed9dda7aa01ea10cdc46b802
parent73e796cb007989449da95fb4adf936ee76b766ca
cmd/asm, cmd/internal/obj/riscv: fix branch pseudo-instructions

Pseudo branch instructions BGT, BGTU, BLE, and BLEU implemented In
CL 226397 were translated inconsistently compared to other ones due
to the inversion of registers. For instance, while "BLT a, b" generates
"jump if a < b", "BLE a, b" generates "jump if b <= a."

This CL fixes the translation in the assembler and the tests.

Change-Id: Ia757be73e848734ca5b3a790e081f7c4f98c30f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/271911
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>
src/cmd/asm/internal/asm/testdata/riscvenc.s
src/cmd/internal/obj/riscv/obj.go
src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.go