Use atomic memory read/write functions in tests.

This ensures compiler optimisations won't interfere with the tests.
This commit is contained in:
Martin Whitaker
2021-12-23 09:46:01 +00:00
parent eb58a63ad4
commit 11c0c6c2f5
10 changed files with 126 additions and 51 deletions

View File

@@ -5,7 +5,7 @@
* Provides some common definitions and helper functions for the memory
* tests.
*
* Copyright (C) 2020 Martin Whitaker.
* Copyright (C) 2020-2021 Martin Whitaker.
*/
#include <stddef.h>
@@ -13,6 +13,19 @@
#include "test.h"
/*
* Test word atomic read and write functions.
*/
#ifdef __x86_64__
#include "memrw64.h"
#define read_word read64
#define write_word write64
#else
#include "memrw32.h"
#define read_word read32
#define write_word write32
#endif
/*
* A wrapper for guiding branch prediction.
*/