forked from Imagelibrary/rtems
tmcontext01: Prevent optimizations
The previous method to prevent optimizations no longer worked at least with GCC 13. Disable intra-procedural optimizations.
This commit is contained in:
@@ -49,8 +49,6 @@ const char rtems_test_name[] = "TMCONTEXT 1";
|
|||||||
|
|
||||||
static rtems_counter_ticks t[SAMPLES];
|
static rtems_counter_ticks t[SAMPLES];
|
||||||
|
|
||||||
static volatile int prevent_optimization;
|
|
||||||
|
|
||||||
static size_t cache_line_size;
|
static size_t cache_line_size;
|
||||||
|
|
||||||
static size_t data_size;
|
static size_t data_size;
|
||||||
@@ -72,17 +70,13 @@ static int dirty_data_cache(volatile int *data, size_t n, size_t clsz, int j)
|
|||||||
return i + j;
|
return i + j;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int call_at_level(
|
static __attribute__((__noipa__)) void call_at_level(
|
||||||
int start,
|
int start,
|
||||||
int fl,
|
int fl,
|
||||||
int s,
|
int s,
|
||||||
bool dirty
|
bool dirty
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int prevent_optimization;
|
|
||||||
|
|
||||||
prevent_optimization = start + fl;
|
|
||||||
|
|
||||||
if (fl == start) {
|
if (fl == start) {
|
||||||
/*
|
/*
|
||||||
* Some architectures like the SPARC have register windows. A side-effect
|
* Some architectures like the SPARC have register windows. A side-effect
|
||||||
@@ -99,6 +93,7 @@ static int call_at_level(
|
|||||||
s,
|
s,
|
||||||
dirty
|
dirty
|
||||||
);
|
);
|
||||||
|
__asm__ volatile ("" : : : "memory");
|
||||||
} else {
|
} else {
|
||||||
char *volatile space;
|
char *volatile space;
|
||||||
rtems_counter_ticks a;
|
rtems_counter_ticks a;
|
||||||
@@ -120,8 +115,6 @@ static int call_at_level(
|
|||||||
b = rtems_counter_read();
|
b = rtems_counter_read();
|
||||||
t[s] = rtems_counter_difference(b, a);
|
t[s] = rtems_counter_difference(b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
return prevent_optimization;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_task(rtems_task_argument arg)
|
static void load_task(rtems_task_argument arg)
|
||||||
@@ -149,7 +142,7 @@ static void sort_t(void)
|
|||||||
qsort(&t[0], SAMPLES, sizeof(t[0]), cmp);
|
qsort(&t[0], SAMPLES, sizeof(t[0]), cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_by_function_level(int fl, bool dirty)
|
static __attribute__((__noipa__)) void test_by_function_level(int fl, bool dirty)
|
||||||
{
|
{
|
||||||
RTEMS_INTERRUPT_LOCK_DECLARE(, lock)
|
RTEMS_INTERRUPT_LOCK_DECLARE(, lock)
|
||||||
rtems_interrupt_lock_context lock_context;
|
rtems_interrupt_lock_context lock_context;
|
||||||
@@ -160,8 +153,6 @@ static void test_by_function_level(int fl, bool dirty)
|
|||||||
uint64_t q3;
|
uint64_t q3;
|
||||||
uint64_t max;
|
uint64_t max;
|
||||||
|
|
||||||
fl += prevent_optimization;
|
|
||||||
|
|
||||||
rtems_interrupt_lock_initialize(&lock, "test");
|
rtems_interrupt_lock_initialize(&lock, "test");
|
||||||
rtems_interrupt_lock_acquire(&lock, &lock_context);
|
rtems_interrupt_lock_acquire(&lock, &lock_context);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user