[Bug target/31334] Bad codegen for vectorized induction with altivec

dje at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Mar 24 13:30:00 GMT 2007



------- Comment #1 from dje at gcc dot gnu dot org  2007-03-24 13:30 -------
Loading the constant through memory appears to be related to the vector plus
expander.

118t.final_cleanup shows:

  vect_vec_iv_.32 = vect_cst_.30 + {4, 4, 4, 4};

and 120r.expand shows:

;; vect_vec_iv_.32 = vect_cst_.30 + {4, 4, 4, 4}
(insn 12 10 13 (set (reg:SI 134)
        (const_int 4 [0x4])) -1 (nil)
    (nil))

(insn 13 12 14 (set (mem/c/i:SI (plus:SI (reg/f:SI 115 virtual-stack-vars)
                (const_int 8 [0x8])) [2 S4 A128])
        (reg:SI 134)) -1 (nil)
    (nil))

(insn 14 13 15 (parallel [
            (set (reg:V4SI 133)
                (mem/c/i:V4SI (plus:SI (reg/f:SI 115 virtual-stack-vars)
                        (const_int 8 [0x8])) [2 S16 A128]))
            (unspec [
                    (const_int 0 [0x0])
                ] 196)
        ]) -1 (nil)
    (nil))

(insn 15 14 16 (set (reg:V4SI 133)
        (vec_duplicate:V4SI (vec_select:SI (reg:V4SI 133)
                (parallel [
                        (const_int 0 [0x0])
                    ])))) -1 (nil)
    (nil))

(insn 16 15 0 (set (reg:V4SI 126 [ vect_vec_iv_.32 ])
        (plus:V4SI (reg:V4SI 127 [ vect_cst_.30 ])
            (reg:V4SI 133))) -1 (nil)
    (nil))

The constants appear to be constructor expressions:

 <plus_expr 0x4019d700
    type <vector_type 0x400e7ea0 __vector signed int
        type <integer_type 0x40074340 int sizes-gimplified public SI
            size <integer_cst 0x40068500 constant invariant 32>
            unit size <integer_cst 0x400682a0 constant invariant 4>
            align 32 symtab 0 alias set 2 canonical type 0x40074340 precision
32 min <integer_cst 0x400684a0 -2147483648> max <integer_cst 0x400684c0
2147483647>
            pointer_to_this <pointer_type 0x40074e38>>
        V4SI
        size <integer_cst 0x40068740 constant invariant 128>
        unit size <integer_cst 0x40068760 constant invariant 16>
        align 128 symtab 0 alias set -1 canonical type 0x400e7ea0 nunits 4>

    arg 0 <var_decl 0x401a3150 vect_vec_iv_.32 type <vector_type 0x400e7ea0
__vector signed int>
        used ignored V4SI file d.c line 2 size <integer_cst 0x40068740 128>
unit size <integer_cst 0x40068760 16>
        align 128 context <function_decl 0x4015ae00 main1>
        (reg:V4SI 126 [ vect_vec_iv_.32 ])>
    arg 1 <constructor 0x401a6120 type <vector_type 0x400e7ea0 __vector signed
int>
        constant>>


 <constructor 0x401a6120
    type <vector_type 0x400e7ea0 __vector signed int
        type <integer_type 0x40074340 int sizes-gimplified public SI
            size <integer_cst 0x40068500 constant invariant 32>
            unit size <integer_cst 0x400682a0 constant invariant 4>
            align 32 symtab 0 alias set 2 canonical type 0x40074340 precision
32 min <integer_cst 0x400684a0 -2147483648> max <integer_cst 0x400684c0
2147483647>
            pointer_to_this <pointer_type 0x40074e38>>
        V4SI
        size <integer_cst 0x40068740 constant invariant 128>
        unit size <integer_cst 0x40068760 constant invariant 16>
        align 128 symtab 0 alias set -1 canonical type 0x400e7ea0 nunits 4>
    constant>


And the constructors are thrown into memory.  The original expression with a
constant never gets converted to RTL and never is evaluated as an easy vector
constant.


-- 

dje at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-24 13:30:37
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31334



More information about the Gcc-bugs mailing list