source: icGREP/icgrep-devel/icgrep/kernels/evenodd.cpp @ 5446

Last change on this file since 5446 was 5440, checked in by nmedfort, 2 years ago

Large refactoring step. Removed IR generation code from Kernel (formally KernelBuilder?) and moved it into the new KernelBuilder? class.

File size: 944 bytes
Line 
1/*
2 *  Copyright (c) 2017 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 */
5
6#include "evenodd.h"
7#include <kernels/kernel_builder.h>
8
9using namespace llvm;
10
11namespace kernel {
12
13void EvenOddKernel::generateDoBlockMethod(const std::unique_ptr<KernelBuilder> & iBuilder) {
14    Value * even = iBuilder->simd_fill(64, iBuilder->getInt64(0x5555555555555555));
15    Value * odd = iBuilder->bitCast(iBuilder->simd_fill(8, iBuilder->getInt8(0xAA)));
16    iBuilder->storeOutputStreamBlock("even_odd", iBuilder->getInt32(0), even);
17    iBuilder->storeOutputStreamBlock("even_odd", iBuilder->getInt32(1), odd);
18}
19
20EvenOddKernel::EvenOddKernel(const std::unique_ptr<kernel::KernelBuilder> & builder)
21: BlockOrientedKernel("EvenOdd", {Binding{builder->getStreamSetTy(8, 1), "BasisBits"}}, {Binding{builder->getStreamSetTy(2, 1), "even_odd"}}, {}, {}, {}) {
22    setNoTerminateAttribute(true);
23
24}
25
26}
Note: See TracBrowser for help on using the repository browser.