Comment

Comment by CodeArtisan

When compiling with GCC, the option `-fopt-info-vec-all` gives you information about the vectorization of the code. In this case, GCC reports

   // the for block
   <source>:10:24: note: ===== analyze_loop_nest =====
   <source>:10:24: note: === vect_analyze_loop_form ===
   <source>:10:24: note: not vectorized: control flow in loop.
   <source>:10:24: note: bad loop form.
   <source>:5:6: note: vectorized 0 loops in function.
   
   // the if block inside the for block
   <source>:11:9: note: got vectype for stmt: _4 = *_3;
   const vector(16) int
   <source>:11:9: note: got vectype for stmt: _8 = *_7;
   const vector(16) int
   <source>:11:9: note: === vect_analyze_data_ref_accesses ===
   <source>:11:9: note: not vectorized: no grouped stores in basic block.
   <source>:11:9: note: ===vect_slp_analyze_bb===
   <source>:11:9: note: ===vect_slp_analyze_bb===
   <source>:11:9: note: === vect_analyze_data_refs ===
   <source>:11:9: note: not vectorized: not enough data-refs in basic block.
edit: with intel compiler using `-qopt-report=5 -qopt-report-phase=vec -qopt-report-file=stdout`

   Begin optimization report for: is_sorted(const int32_t *, size_t)

        Report from: Vector optimizations [vec]
    
    LOOP BEGIN at <source>(12,5)
    
       remark #15324: loop was not vectorized: unsigned types for induction
                      variable and/or for lower/upper iteration bounds make
                      loop uncountable

    LOOP END
parent CodeArtisan 8 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton