gcc/

        * config/loongarch/lasx.md (lasx_xvperm_<lasxfmt_f_wd>): Add
        "@" for gen_lasx_xvperm helper.
        * config/loongarch/loongarch.cc (loongarch_expand_vec_perm_1):
        Call gen_lasx_xvperm to unify V8SF and V8SI handling.
---
 gcc/config/loongarch/lasx.md      |  4 ++--
 gcc/config/loongarch/loongarch.cc | 25 ++++++-------------------
 2 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/gcc/config/loongarch/lasx.md b/gcc/config/loongarch/lasx.md
index e0af1e4c590..2b63507f22f 100644
--- a/gcc/config/loongarch/lasx.md
+++ b/gcc/config/loongarch/lasx.md
@@ -469,8 +469,8 @@ (define_insn "vec_concat<mode>"
   [(set_attr "type" "simd_splat")
    (set_attr "mode" "<MODE>")])
 
-;; xshuf.w
-(define_insn "lasx_xvperm_<lasxfmt_f_wd>"
+;; xvperm.w
+(define_insn "@lasx_xvperm_<lasxfmt_f_wd>"
   [(set (match_operand:LASX_W 0 "register_operand" "=f")
        (unspec:LASX_W
          [(match_operand:LASX_W 1 "nonimmediate_operand" "f")
diff --git a/gcc/config/loongarch/loongarch.cc 
b/gcc/config/loongarch/loongarch.cc
index 73ff7e4274e..3a5ccda808e 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -9133,33 +9133,20 @@ loongarch_expand_vec_perm_1 (rtx operands[])
   switch (mode)
     {
     case E_V8SImode:
+    case E_V8SFmode:
       if (one_operand_shuffle)
        {
-         emit_insn (gen_lasx_xvperm_w (target, op0, mask));
+         emit_insn (gen_lasx_xvperm (mode, target, op0, mask));
          if (target != operands[0])
            emit_move_insn (operands[0],
                            gen_lowpart (GET_MODE (operands[0]), target));
        }
       else
        {
-         t1 = gen_reg_rtx (V8SImode);
-         t2 = gen_reg_rtx (V8SImode);
-         emit_insn (gen_lasx_xvperm_w (t1, op0, mask));
-         emit_insn (gen_lasx_xvperm_w (t2, op1, mask));
-         goto merge_two;
-       }
-      return;
-
-    case E_V8SFmode:
-      mask = gen_lowpart (V8SImode, mask);
-      if (one_operand_shuffle)
-       emit_insn (gen_lasx_xvperm_w_f (target, op0, mask));
-      else
-       {
-         t1 = gen_reg_rtx (V8SFmode);
-         t2 = gen_reg_rtx (V8SFmode);
-         emit_insn (gen_lasx_xvperm_w_f (t1, op0, mask));
-         emit_insn (gen_lasx_xvperm_w_f (t2, op1, mask));
+         t1 = gen_reg_rtx (mode);
+         t2 = gen_reg_rtx (mode);
+         emit_insn (gen_lasx_xvperm (mode, t1, op0, mask));
+         emit_insn (gen_lasx_xvperm (mode, t2, op1, mask));
          goto merge_two;
        }
       return;
-- 
2.51.2

Reply via email to