Hello,
After I vectorize the following file by GCC for testing, it gets the
right "129t.final_cleanup" file. However, it expands to the wrong
vector type when stores the "short int" into memory. I have checked
many times, but I still don't know why.  Can anyone help me?

The source file is:
short int b[20], c[20];

int main(){
        int i;

        for(i=0; i<20; i++)
        {
           b[i]=6;
           c[i]=9;
        }
return 0;
}

The 129t.final_cleanup file is:
;; Function main (main)

main ()
{
  unsigned int ivtmp.44;

<bb 2>:
  ivtmp.44 = 0;

<bb 3>:
  MEM[base: &b + ivtmp.44] = { 6, 6, 6, 6 };    //It rightly expands
here! And it rightly vectorizes here!
  MEM[base: &c + ivtmp.44] = { 9, 9, 9, 9 };
  ivtmp.44 = ivtmp.44 + 8;
  if (ivtmp.44 != 40)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 4>:
  return 0;

}

The "131r.expand" file is:

(insn 52 51 53 4 hello21.c:10 (set (reg/f:SI 241)
        (symbol_ref:SI ("b") <var_decl 0x2ae0d6c0 b>)) -1 (nil))

(insn 53 52 54 4 hello21.c:10 (set (reg:SI 240)
        (plus:SI (reg/f:SI 241)
            (reg:SI 238 [ ivtmp.44 ]))) -1 (nil))

(insn 54 53 55 4 hello21.c:10 (set (reg:SI 242)
        (high:SI (symbol_ref/u:SI ("*.LC0") [flags 0x2]))) -1 (nil))

(insn 55 54 56 4 hello21.c:10 (set (reg:V2SI 243)
// why it expands the scalar type to "V2SI" rather than "V4HI", which
is different from "129t.final_cleanup" file
        (mem/u/c/i:V2SI (lo_sum:SI (reg:SI 242)
                (symbol_ref/u:SI ("*.LC0") [flags 0x2])) [4 S8 A64])) -1 (nil))

(insn 56 55 57 4 hello21.c:10 (set (mem:V2SI (reg:SI 240) [4 S8 A64])
        (reg:V2SI 243)) -1 (nil))

Why it expands to the wrong type?

Thanks very much!
Caixia

Reply via email to