#include "mlir/ExecutionEngine/CRunnerUtils.h"
#include "mlir/ExecutionEngine/Msan.h"
#ifndef _WIN32
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
defined(__DragonFly__)
#include <cstdlib>
#else
#include <alloca.h>
#endif
#include <sys/time.h>
#else
#include "malloc.h"
#endif
#include <algorithm>
#include <cinttypes>
#include <cstdio>
#include <cstdlib>
#include <numeric>
#include <random>
#include <string.h>
#ifdef MLIR_CRUNNERUTILS_DEFINE_FUNCTIONS
namespace {
template <typename V>
void stdSort(uint64_t n, V *p) { … }
}
extern "C" void printI64(int64_t i) { … }
extern "C" void printU64(uint64_t u) { … }
extern "C" void printF32(float f) { … }
extern "C" void printF64(double d) { … }
extern "C" void printString(char const *s) { … }
extern "C" void printOpen() { … }
extern "C" void printClose() { … }
extern "C" void printComma() { … }
extern "C" void printNewline() { … }
extern "C" void memrefCopy(int64_t elemSize, UnrankedMemRefType<char> *srcArg,
UnrankedMemRefType<char> *dstArg) { … }
extern "C" void printFlops(double flops) { … }
extern "C" double rtclock() { … }
extern "C" void *mlirAlloc(uint64_t size) { … }
extern "C" void *mlirAlignedAlloc(uint64_t alignment, uint64_t size) { … }
extern "C" void mlirFree(void *ptr) { … }
extern "C" void mlirAlignedFree(void *ptr) { … }
extern "C" void *rtsrand(uint64_t s) { … }
extern "C" uint64_t rtrand(void *g, uint64_t m) { … }
extern "C" void rtdrand(void *g) { … }
extern "C" void _mlir_ciface_shuffle(StridedMemRefType<uint64_t, 1> *mref,
void *g) { … }
#define IMPL_STDSORT …
IMPL_STDSORT(I64, int64_t)
IMPL_STDSORT(F64, double)
IMPL_STDSORT(F32, float)
#undef IMPL_STDSORT
#endif