mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-02 18:53:22 +00:00
30 lines
400 B
C++
30 lines
400 B
C++
|
extern "C" void abort ();
|
||
|
|
||
|
struct S
|
||
|
{
|
||
|
int a, b, c, d;
|
||
|
|
||
|
int sum (void)
|
||
|
{
|
||
|
int val = 0;
|
||
|
val += a + b + this->c + this->d;
|
||
|
return val;
|
||
|
}
|
||
|
|
||
|
int sum_offload (void)
|
||
|
{
|
||
|
int val = 0;
|
||
|
#pragma omp target map(val)
|
||
|
val += a + b + this->c + this->d;
|
||
|
return val;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
int main (void)
|
||
|
{
|
||
|
S s = { 1, 2, 3, 4 };
|
||
|
if (s.sum () != s.sum_offload ())
|
||
|
abort ();
|
||
|
return 0;
|
||
|
}
|