forked from OpenCilk/opencilk-project
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Sema] Fix semantic analysis of simple cilk_for loops to get rid of e…
…rroneous unused-comparison warnings.
- Loading branch information
Showing
6 changed files
with
63 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// RUN: %clang_cc1 %s -fopencilk -verify -fsyntax-only | ||
// expected-no-diagnostics | ||
|
||
typedef long long int64_t; | ||
|
||
template <bool transpose> | ||
__attribute__((always_inline)) static int64_t a_index(int64_t ii, int64_t m, | ||
int64_t jj, int64_t n) { | ||
return transpose ? ((jj * m) + ii) : ((ii * n) + jj); | ||
} | ||
|
||
#define ARG_INDEX(arg, ii, m, jj, n, transpose) \ | ||
(arg[a_index<transpose>(ii, m, jj, n)]) | ||
|
||
template <typename F> | ||
void matmul_ploops(F *__restrict__ out, const F *__restrict__ lhs, | ||
const F *__restrict__ rhs, int64_t m, int64_t n, | ||
int64_t k) { | ||
_Cilk_for(int64_t i = 0; i < m; ++i) { | ||
_Cilk_for(int64_t j = 0; j < n; ++j) { | ||
out[j * m + i] = 0.0; | ||
for (int64_t l = 0; l < k; ++l) | ||
out[j * m + i] += ARG_INDEX(lhs, l, k, i, m, true) * | ||
ARG_INDEX(rhs, j, n, l, k, true); | ||
} | ||
} | ||
} | ||
|
||
template void matmul_ploops<float>(float *__restrict__ out, | ||
const float *__restrict__ lhs, | ||
const float *__restrict__ rhs, int64_t m, | ||
int64_t n, int64_t k); |