Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions test/benchmark/axpy/axpy_int.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
namespace {
constexpr int kN = 16;
constexpr int kA = 3;
} // namespace

// Keep the function name matching "kernel" so llvm-extract --rfunc=".*kernel.*" can find it.
extern "C" void kernel_axpy_int(int n, int a, const int *x, int *y) {
for (int i = 0; i < n; ++i) {
y[i] = a * x[i] + y[i];
extern "C" void kernel_axpy_int(const int *x, int *y) {
for (int i = 0; i < kN; ++i) {
y[i] = kA * x[i] + y[i];
}
}

// Provide a tiny main so clang emits a complete TU; tests extract only the kernel anyway.
int main() {
const int N = 16;
static int x[N];
static int y[N];
kernel_axpy_int(N, /*a=*/3, x, y);
static int x[kN];
static int y[kN];
kernel_axpy_int(x, y);
return 0;
}

Expand Down
Loading