]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: Fix selector error in lasx_xvexth_h/w/d* patterns
authorGuo Jie <guojie@loongson.cn>
Mon, 30 Dec 2024 02:37:18 +0000 (10:37 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Thu, 2 Jan 2025 01:27:39 +0000 (09:27 +0800)
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.

gcc/config/loongarch/lasx.md

index 8afd0ffd7c5581365bd7c5836c9e150a27b72687..df91016037f960a30e246a08f2f0390b31a3c24a 100644 (file)
        (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)
        (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"
        (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"