main
|
Last change
on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100755
|
|
File size:
927 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | !!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
|
|---|
| 3 | !!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC
|
|---|
| 4 | !!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details.
|
|---|
| 5 | !!!
|
|---|
| 6 | !!! SPDX-License-Identifier: (BSD-3-Clause)
|
|---|
| 7 | !!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | /* The safelen(2) clause safelen(2)@24:20 guarantees that the vector code is safe for vectors up to 2 (inclusive).
|
|---|
| 11 | * In the loop, m can be 2 or more for the correct execution. If the value of m is less than 2,
|
|---|
| 12 | * the behavior is undefined. No Data Race in b[i]@26:5 assignment.
|
|---|
| 13 | * */
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 | #include <stdio.h>
|
|---|
| 17 | #include <omp.h>
|
|---|
| 18 |
|
|---|
| 19 | int main(){
|
|---|
| 20 |
|
|---|
| 21 | int i, m=2, n=4;
|
|---|
| 22 | int b[4] = {};
|
|---|
| 23 |
|
|---|
| 24 | #pragma omp simd safelen(2)
|
|---|
| 25 | for (i = m; i<n; i++)
|
|---|
| 26 | b[i] = b[i-m] - 1.0f;
|
|---|
| 27 |
|
|---|
| 28 | printf("Expected: -1; Real: %d\n",b[3]);
|
|---|
| 29 | return 0;
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.