This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lno] Induction variable optimizations






> So 4 counters are generated, 3 of which always have the same value.

This might be (partly?) due to
http://gcc.gnu.org/ml/gcc-patches/2004-01/msg02847.html.
I'll let you know when the patch is in so you could give it another try.

dorit



                                                                                                                                          
                      Falk Hueffner                                                                                                       
                      <falk.hueffner@student.uni-tu        To:       Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>,                    
                      ebingen.de>                           gcc-patches@gcc.gnu.org                                                       
                      Sent by:                             cc:                                                                            
                      gcc-patches-owner@gcc.gnu.org        Subject:  Re: [lno] Induction variable optimizations                           
                                                                                                                                          
                                                                                                                                          
                      26/01/2004 01:03                                                                                                    
                                                                                                                                          




Hi,

I still get very bad code from vectorized loops on Alpha. Example:

char a[N]; char b[N]; char c[N];
void f() {
    long i;
    for (i=0; i<N+1; i++)   // loop count misrecognition workaround
 a[i] = b[i] + c[i];
}

I added a fake addv8qi3 instruction to the Alpha md to be able to see
clearer what's happening. Then this is what I get from -O3
-ftree-vectorize:

$f..ng:
        .prologue 1
        mov $31,$23
        mov $31,$22
        mov $31,$8
        mov $31,$7
        ldq $28,b($29)          !literal
        ldq $25,c($29)          !literal
        ldq $24,a($29)          !literal
        .align 4
$L2:
        s8addq $23,0,$21
        s8addq $22,0,$20
        s8addq $8,0,$16
        cmpule $7,15,$6
        zapnot $21,15,$19   <- zero extension
        zapnot $20,15,$18
        addl $7,1,$7
        addl $23,1,$23
        addq $19,$28,$17
        addq $18,$25,$3
        addl $22,1,$22
        addl $8,1,$8
        ldq $0,0($17)
        ldq $5,0($3)
        zapnot $16,15,$2
        addq $2,$24,$4
        addv8qi3 $0,$5,$1
        stq $1,0($4)
        bne $6,$L2
        ret $31,($26),1

So 4 counters are generated, 3 of which always have the same value.
Also, the offsets are zero extended (which is wasteful, although in
this case it couldn't lead to wrong code since there are no negative
or very large offsets). I've attached the t28.vect dump.

To reproduce, try this patch:

Index: gcc/config/alpha/alpha.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.md,v
retrieving revision 1.194.2.16
diff -u -p -r1.194.2.16 alpha.md
--- gcc/config/alpha/alpha.md 29 Oct 2003 21:36:05 -0000    1.194.2.16
+++ gcc/config/alpha/alpha.md 25 Jan 2004 22:55:06 -0000
@@ -6370,6 +6370,14 @@
    stt %R1,%0"
   [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])

+(define_insn "addv8qi3"
+  [(set (match_operand:V8QI 0 "register_operand" "=r")
+     (plus:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "%rJ")
+               (match_operand:V8QI 2 "reg_or_8bit_operand" "rI")))]
+  ""
+  "addv8qi3 %r1,%2,%0"
+  [(set_attr "type" "iadd")])
+
 (define_insn "uminv8qi3"
   [(set (match_operand:V8QI 0 "register_operand" "=r")
  (umin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
Index: gcc/config/alpha/alpha.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.h,v
retrieving revision 1.170.2.22.2.1
diff -u -p -r1.170.2.22.2.1 alpha.h
--- gcc/config/alpha/alpha.h  21 Jan 2004 01:11:29 -0000    1.170.2.22.2.1
+++ gcc/config/alpha/alpha.h  25 Jan 2004 22:55:08 -0000
@@ -482,6 +482,8 @@ extern const char *alpha_tls_size_string
 /* Width of a word, in units (bytes).  */
 #define UNITS_PER_WORD 8

+#define UNITS_PER_SIMD_WORD 8
+
 /* Width in bits of a pointer.
    See also the macro `Pmode' defined below.  */
 #define POINTER_SIZE 64


--
 Falk




#### vec.c.t28.vect has been removed from this note on January 26, 2004 by
Dorit Naishlos


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]