]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
LoongArch: Warn about right shifts of negative numbers
authorLulu Cai <cailulu@loongson.cn>
Wed, 2 Apr 2025 02:23:40 +0000 (10:23 +0800)
committercailulu <cailulu@loongson.cn>
Tue, 8 Apr 2025 02:05:51 +0000 (10:05 +0800)
commit4fe96ddaf6140de99ad8a046de3989478c443d03
tree3bc5242d9f9286517bda7a485be0f4a1664c75a6
parent6a51b5955a076995099eadffd70d4ff00bcd6d5a
LoongArch: Warn about right shifts of negative numbers

The GNU Assembler User Guide says that the right shift operator ">>"
in an expression is the same as the C operator.

On LoongArch the assembler directives and instructions do not treat
negative numbers ">>" the same way. The directives treats negative
numbers ">>" as logical right shifts while the instructions treats them
as arithmetic right shifts.

The right shift of negative numbers in the instructions may be changed
from an arithmetic right shift to a logical right shift in the future,
and a warning is issued for this.
gas/config/loongarch-parse.y
gas/testsuite/gas/loongarch/loongarch.exp
gas/testsuite/gas/loongarch/negative_right_shift.d [new file with mode: 0644]
gas/testsuite/gas/loongarch/negative_right_shift.l [new file with mode: 0644]
gas/testsuite/gas/loongarch/negative_right_shift.s [new file with mode: 0644]