[RFC PATCH 1/5] LoongArch: Fix some instruction formats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



struct reg2i12_format is used to generate the instruction lu52id
in larch_insn_gen_lu52id(), according to the instruction format
of lu52id in LoongArch Reference Manual [1], the type of field
"immediate" should be "signed int" rather than "unsigned int".

There are similar problems in the other structs reg0i26_format,
reg1i20_format, reg1i21_format and reg2i16_format, fix them.

[1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_lu12i_w_lu32i_d_lu52i_d

Fixes: b738c106f735 ("LoongArch: Add other common headers")
Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
 arch/loongarch/include/asm/inst.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/loongarch/include/asm/inst.h b/arch/loongarch/include/asm/inst.h
index 7b07cbb..ff51481 100644
--- a/arch/loongarch/include/asm/inst.h
+++ b/arch/loongarch/include/asm/inst.h
@@ -53,35 +53,35 @@ enum reg2i16_op {
 };
 
 struct reg0i26_format {
-	unsigned int immediate_h : 10;
-	unsigned int immediate_l : 16;
+	signed int immediate_h : 10;
+	signed int immediate_l : 16;
 	unsigned int opcode : 6;
 };
 
 struct reg1i20_format {
 	unsigned int rd : 5;
-	unsigned int immediate : 20;
+	signed int immediate : 20;
 	unsigned int opcode : 7;
 };
 
 struct reg1i21_format {
-	unsigned int immediate_h  : 5;
+	signed int immediate_h  : 5;
 	unsigned int rj : 5;
-	unsigned int immediate_l : 16;
+	signed int immediate_l : 16;
 	unsigned int opcode : 6;
 };
 
 struct reg2i12_format {
 	unsigned int rd : 5;
 	unsigned int rj : 5;
-	unsigned int immediate : 12;
+	signed int immediate : 12;
 	unsigned int opcode : 10;
 };
 
 struct reg2i16_format {
 	unsigned int rd : 5;
 	unsigned int rj : 5;
-	unsigned int immediate : 16;
+	signed int immediate : 16;
 	unsigned int opcode : 6;
 };
 
-- 
2.1.0




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux