[Bug c/66862] New: OpenMP SIMD does not work (use SIMD instructions) on conditional code

2015-07-13 Thread bill.jordan at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66862

Bug ID: 66862
   Summary: OpenMP SIMD does not work (use SIMD instructions) on
conditional code
   Product: gcc
   Version: 5.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bill.jordan at intel dot com
  Target Milestone: ---

Created attachment 35971
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35971&action=edit
SIMD sample code

In the following loop,the omp simd pragma has no affect:

 #pragma omp simd private(value) linear(ij, kj) safelen(64)
 for (j = 0; j < switches; ++j) {
 value = cost[ik] + cost[kj];
 if (value < cost[ij]) {
 cost[ij] = value;
 }
 ++ij; ++kj;
 }

Without the "if" clause, the compiler will generate SIMD code.

Compilation line is:
 gcc -Wall -Wextra -O3 -save-temps -fopenmp-simd -c floyds_simd.c

Attached source includes 4 routines:
 floyds_wo_omp_simd: Base function.
 floyds_w_omp_simd: Base function with #pragma omp simd directive
 not_floyds_wo_omp_simd: Base function without if clause
 not_floyds_w_omp_simd: Base function without if clause with #pragma omp simd


[Bug c/66862] OpenMP SIMD does not work (use SIMD instructions) on conditional code

2015-07-13 Thread bill.jordan at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66862

--- Comment #1 from William Jordan  ---
Created attachment 35972
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35972&action=edit
Disassembled code

Assembly shows that code generated with #pragma omp simd is the same as without
when the "for" loop contains an "if" statement. Without the "if" statement, the
#pragma omp simd uses SIMD operations seen in not_floyds_w_omp_simd function.