diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2024-01-09 10:27:39 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2024-01-15 07:26:05 +0100 |
commit | 08fd47b8033c73672ba31b4fc26547c201c9b26f (patch) | |
tree | e215442f3cae541ce14743437b85e4c963f80fed /testsuites/tmtests | |
parent | libio: Clean up usage of rtems_termios_device_mode (diff) | |
download | rtems-08fd47b8033c73672ba31b4fc26547c201c9b26f.tar.bz2 |
tmcontext01: Prevent optimizations
The previous method to prevent optimizations no longer worked at least
with GCC 13. Disable intra-procedural optimizations.
Diffstat (limited to 'testsuites/tmtests')
-rw-r--r-- | testsuites/tmtests/tmcontext01/init.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/testsuites/tmtests/tmcontext01/init.c b/testsuites/tmtests/tmcontext01/init.c index 1cba67bb3f..5aea18e5f1 100644 --- a/testsuites/tmtests/tmcontext01/init.c +++ b/testsuites/tmtests/tmcontext01/init.c @@ -49,8 +49,6 @@ const char rtems_test_name[] = "TMCONTEXT 1"; static rtems_counter_ticks t[SAMPLES]; -static volatile int prevent_optimization; - static size_t cache_line_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; } -static int call_at_level( +static __attribute__((__noipa__)) void call_at_level( int start, int fl, int s, bool dirty ) { - int prevent_optimization; - - prevent_optimization = start + fl; - if (fl == start) { /* * Some architectures like the SPARC have register windows. A side-effect @@ -99,6 +93,7 @@ static int call_at_level( s, dirty ); + __asm__ volatile ("" : : : "memory"); } else { char *volatile space; rtems_counter_ticks a; @@ -120,8 +115,6 @@ static int call_at_level( b = rtems_counter_read(); t[s] = rtems_counter_difference(b, a); } - - return prevent_optimization; } 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); } -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_context lock_context; @@ -160,8 +153,6 @@ static void test_by_function_level(int fl, bool dirty) uint64_t q3; uint64_t max; - fl += prevent_optimization; - rtems_interrupt_lock_initialize(&lock, "test"); rtems_interrupt_lock_acquire(&lock, &lock_context); |