numam-dpdk/app/test/test_prefetch.c
Harry van Haaren 31f83163cf eal: add new prefetch write variants
This commit adds new rte_prefetchX_write() variants, that suggest to the
compiler to use a prefetch instruction with intention to write. As a
compiler builtin, the compiler can choose based on compilation target
what the best implementation for this instruction is.

Three versions are provided, targeting the different levels of cache.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2020-10-15 21:49:59 +02:00

37 lines
585 B
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2014 Intel Corporation
*/
#include <stdio.h>
#include <stdint.h>
#include <rte_prefetch.h>
#include "test.h"
/*
* Prefetch test
* =============
*
* - Just test that the macro can be called and validate the compilation.
* The test always return success.
*/
static int
test_prefetch(void)
{
int a;
rte_prefetch0(&a);
rte_prefetch1(&a);
rte_prefetch2(&a);
rte_prefetch0_write(&a);
rte_prefetch1_write(&a);
rte_prefetch2_write(&a);
return 0;
}
REGISTER_TEST_COMMAND(prefetch_autotest, test_prefetch);