movsi_internal_la32 used on LA32, movsi_internal used on LA64.
gcc/ChangeLog:
* config/loongarch/loongarch.md (*movsi_internal_la32): New.
---
gcc/config/loongarch/loongarch.md | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/gcc/config/loongarch/loongarch.md
b/gcc/config/loongarch/loongarch.md
index c04f9eb9970..be273c0cc47 100644
--- a/gcc/config/loongarch/loongarch.md
+++ b/gcc/config/loongarch/loongarch.md
@@ -2313,8 +2313,28 @@ (define_expand "movsi"
(define_insn_and_split "*movsi_internal"
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,w,*f,f,*r,*m")
(match_operand:SI 1 "move_operand" "r,Yd,w,rJ,*r*J,m,*f,*f"))]
- "(register_operand (operands[0], SImode)
- || reg_or_0_operand (operands[1], SImode))"
+ "TARGET_64BIT
+ && (register_operand (operands[0], SImode)
+ || reg_or_0_operand (operands[1], SImode))"
+ { return loongarch_output_move (operands); }
+ "CONST_INT_P (operands[1]) && REG_P (operands[0]) && GP_REG_P (REGNO
+ (operands[0]))"
+ [(const_int 0)]
+ "
+{
+ loongarch_move_integer (operands[0], operands[0], INTVAL (operands[1]));
+ DONE;
+}
+ "
+ [(set_attr "move_type" "move,const,load,store,mgtf,fpload,mftg,fpstore")
+ (set_attr "mode" "SI")])
+
+(define_insn_and_split "*movsi_internal_la32"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,*f,f,*r,*m")
+ (match_operand:SI 1 "move_operand" "r,Yd,m,rJ,*r*J,m,*f,*f"))]
+ "TARGET_32BIT
+ && (register_operand (operands[0], SImode)
+ || reg_or_0_operand (operands[1], SImode))"
{ return loongarch_output_move (operands); }
"CONST_INT_P (operands[1]) && REG_P (operands[0]) && GP_REG_P (REGNO
(operands[0]))"