[gcc r15-6488] LoongArch: Fix selector error in lasx_xvexth_h/w/d* patterns

LuluCheng chenglulu@gcc.gnu.org
Thu Jan 2 01:28:23 GMT 2025


https://gcc.gnu.org/g:693a5e6ae83f8606a5af674e18166060cd6a2e0c

commit r15-6488-g693a5e6ae83f8606a5af674e18166060cd6a2e0c
Author: Guo Jie <guojie@loongson.cn>
Date:   Mon Dec 30 10:37:18 2024 +0800

    LoongArch: Fix selector error in lasx_xvexth_h/w/d* patterns
    
    The xvexth related instructions operate SEPARATELY according to
    the high and low 128 bits, and sign/zero extend the upper half
    of every 128 bits in src to the corresponding 128 bits in dest.
    
    For xvexth.d.w, the rule for the first element of dest should be:
        dest.D[0] = sign_extend (src.W[2] ,64);
    instead of:
        dest.D[0] = sign_extend (src.W[4] ,64);
    
    gcc/ChangeLog:
    
            * config/loongarch/lasx.md: Fix selector index.

Diff:
---
 gcc/config/loongarch/lasx.md | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/config/loongarch/lasx.md b/gcc/config/loongarch/lasx.md
index 8afd0ffd7c55..df91016037f9 100644
--- a/gcc/config/loongarch/lasx.md
+++ b/gcc/config/loongarch/lasx.md
@@ -4183,10 +4183,10 @@
 	(any_extend:V16HI
 	  (vec_select:V16QI
 	    (match_operand:V32QI 1 "register_operand" "f")
-	      (parallel [(const_int 16) (const_int 17)
-			 (const_int 18) (const_int 19)
-			 (const_int 20) (const_int 21)
-			 (const_int 22) (const_int 23)
+	      (parallel [(const_int 8) (const_int 9)
+			 (const_int 10) (const_int 11)
+			 (const_int 12) (const_int 13)
+			 (const_int 14) (const_int 15)
 			 (const_int 24) (const_int 25)
 			 (const_int 26) (const_int 27)
 			 (const_int 28) (const_int 29)
@@ -4201,8 +4201,8 @@
 	(any_extend:V8SI
 	  (vec_select:V8HI
 	    (match_operand:V16HI 1 "register_operand" "f")
-	    (parallel [(const_int 8) (const_int 9)
-		       (const_int 10) (const_int 11)
+	    (parallel [(const_int 4) (const_int 5)
+		       (const_int 6) (const_int 7)
 		       (const_int 12) (const_int 13)
 		       (const_int 14) (const_int 15)]))))]
   "ISA_HAS_LASX"
@@ -4215,7 +4215,7 @@
 	(any_extend:V4DI
 	  (vec_select:V4SI
 	    (match_operand:V8SI 1 "register_operand" "f")
-	    (parallel [(const_int 4) (const_int 5)
+	    (parallel [(const_int 2) (const_int 3)
 		       (const_int 6) (const_int 7)]))))]
   "ISA_HAS_LASX"
   "xvexth.d<u>.w<u>\t%u0,%u1"


More information about the Gcc-cvs mailing list