Index: testsuites/smptests/smpatomic08/init.c
===================================================================
--- testsuites/smptests/smpatomic08/init.c	(revision 7136d7f1afa09f8dba4f6c12cde2d012d5a29935)
+++ testsuites/smptests/smpatomic08/init.c	(revision 47b6fad01204a6a2f2a8d455cf396aeb00561d56)
@@ -105,4 +105,43 @@
 }
 
+static void test_fini(
+  test_context *ctx,
+  const char *test,
+  bool atomic
+)
+{
+  uint_fast32_t expected_value = 0;
+  uint_fast32_t actual_value;
+  size_t worker_index;
+
+  printf("=== atomic %s test case ==\n", test);
+
+  for (worker_index = 0; worker_index < ctx->worker_count; ++worker_index) {
+    uint_fast32_t worker_value = ctx->per_worker_value[worker_index];
+
+    expected_value += worker_value;
+
+    printf(
+      "worker %zu value: %" PRIuFAST32 "\n",
+      worker_index,
+      worker_value
+    );
+  }
+
+  if (atomic) {
+    actual_value = _Atomic_Load_uint(&ctx->atomic_value, ATOMIC_ORDER_RELAXED);
+  } else {
+    actual_value = ctx->normal_value;
+  }
+
+  printf(
+    "atomic value: expected = %" PRIuFAST32 ", actual = %" PRIuFAST32 "\n",
+    expected_value,
+    actual_value
+  );
+
+  rtems_test_assert(expected_value == actual_value);
+}
+
 static void test_atomic_add_init(test_context *ctx)
 {
@@ -124,31 +163,5 @@
 static void test_atomic_add_fini(test_context *ctx)
 {
-  uint_fast32_t expected_counter = 0;
-  uint_fast32_t actual_counter;
-  size_t worker_index;
-
-  printf("=== atomic add test case ==\n");
-
-  for (worker_index = 0; worker_index < ctx->worker_count; ++worker_index) {
-    uint_fast32_t worker_counter = ctx->per_worker_value[worker_index];
-
-    expected_counter += worker_counter;
-
-    printf(
-      "atomic add worker %zu counter: %" PRIuFAST32 "\n",
-      worker_index,
-      worker_counter
-    );
-  }
-
-  actual_counter = _Atomic_Load_uint(&ctx->atomic_value, ATOMIC_ORDER_RELAXED);
-
-  printf(
-    "global counter: expected = %" PRIuFAST32 ", actual = %" PRIuFAST32 "\n",
-    expected_counter,
-    actual_counter
-  );
-
-  rtems_test_assert(expected_counter == actual_counter);
+  test_fini(ctx, "add", true);
 }
 
@@ -179,41 +192,15 @@
 static void test_atomic_flag_fini(test_context *ctx)
 {
-  uint_fast32_t expected_counter = 0;
-  uint_fast32_t actual_counter;
-  size_t worker_index;
-
-  printf("=== atomic flag test case ===\n");
-
-  for (worker_index = 0; worker_index < ctx->worker_count; ++worker_index) {
-    uint_fast32_t worker_counter = ctx->per_worker_value[worker_index];
-
-    expected_counter += worker_counter;
-
-    printf(
-      "atomic flag worker %zu counter: %" PRIuFAST32 "\n",
-      worker_index,
-      worker_counter
-    );
-  }
-
-  actual_counter = ctx->normal_value;
-
-  printf(
-    "global flag counter: expected = %" PRIuFAST32 ", actual = %" PRIuFAST32 "\n",
-    expected_counter,
-    actual_counter
-  );
-
-  rtems_test_assert(expected_counter == actual_counter);
+  test_fini(ctx, "flag", false);
 }
 
 static void test_atomic_sub_init(test_context *ctx)
 {
-  _Atomic_Init_uint(&ctx->atomic_value, 0xffffffff);
+  _Atomic_Init_uint(&ctx->atomic_value, 0);
 }
 
 static void test_atomic_sub_body(test_context *ctx, size_t worker_index)
 {
-  uint_fast32_t counter = 0xffffffff;
+  uint_fast32_t counter = 0;
 
   while (!stop(ctx)) {
@@ -222,37 +209,10 @@
   }
 
-  ctx->per_worker_value[worker_index] = 0xffffffff - counter;
+  ctx->per_worker_value[worker_index] = counter;
 }
 
 static void test_atomic_sub_fini(test_context *ctx)
 {
-  uint_fast32_t expected_counter = 0;
-  uint_fast32_t actual_counter;
-  size_t worker_index;
-
-  printf("=== atomic sub test case ==\n");
-
-  for (worker_index = 0; worker_index < ctx->worker_count; ++worker_index) {
-    uint_fast32_t worker_counter = ctx->per_worker_value[worker_index];
-
-    expected_counter += worker_counter;
-
-    printf(
-      "atomic sub worker %zu counter: %" PRIuFAST32 "\n",
-      worker_index,
-      worker_counter
-    );
-  }
-
-  actual_counter = _Atomic_Load_uint(&ctx->atomic_value, ATOMIC_ORDER_RELAXED);
-  actual_counter = 0xffffffff - actual_counter;
-
-  printf(
-    "global counter: expected = %" PRIuFAST32 ", actual = %" PRIuFAST32 "\n",
-    expected_counter,
-    actual_counter
-  );
-
-  rtems_test_assert(expected_counter == actual_counter);
+  test_fini(ctx, "sub", true);
 }
 
@@ -293,31 +253,5 @@
 static void test_atomic_compare_exchange_fini(test_context *ctx)
 {
-  uint_fast32_t expected_counter = 0;
-  uint_fast32_t actual_counter;
-  size_t worker_index;
-
-  printf("=== atomic compare_exchange test case ==\n");
-
-  for (worker_index = 0; worker_index < ctx->worker_count; ++worker_index) {
-    uint_fast32_t worker_counter = ctx->per_worker_value[worker_index];
-
-    expected_counter += worker_counter;
-
-    printf(
-      "atomic compare_exchange worker %zu counter: %" PRIuFAST32 "\n",
-      worker_index,
-      worker_counter
-    );
-  }
-
-  actual_counter = ctx->normal_value;
-
-  printf(
-    "global counter: expected = %" PRIuFAST32 ", actual = %" PRIuFAST32 "\n",
-    expected_counter,
-    actual_counter
-  );
-
-  rtems_test_assert(expected_counter == actual_counter);
+  test_fini(ctx, "compare exchange", false);
 }
 
@@ -359,40 +293,29 @@
 static void test_atomic_or_and_fini(test_context *ctx)
 {
-  uint_fast32_t expected_counter = 0;
-  uint_fast32_t actual_counter;
-  size_t worker_index;
-
-  printf("=== atomic or_and test case ==\n");
-
-  for (worker_index = 0; worker_index < ctx->worker_count; ++worker_index) {
-    uint_fast32_t worker_counter = ctx->per_worker_value[worker_index];
-
-    expected_counter += worker_counter;
-
-    printf(
-      "atomic or_and worker %zu counter: %" PRIuFAST32 "\n",
-      worker_index,
-      worker_counter
-    );
-  }
-
-  actual_counter = _Atomic_Load_uint(&ctx->atomic_value, ATOMIC_ORDER_RELAXED);
-
-  printf(
-    "global counter: expected = %" PRIuFAST32 ", actual = %" PRIuFAST32 "\n",
-    expected_counter,
-    actual_counter
-  );
-
-  rtems_test_assert(expected_counter == actual_counter);
+  test_fini(ctx, "or/and", true);
 }
 
 static const test_case test_cases[] = {
-  { test_atomic_add_init, test_atomic_add_body, test_atomic_add_fini },
-  { test_atomic_flag_init, test_atomic_flag_body, test_atomic_flag_fini },
-  { test_atomic_sub_init, test_atomic_sub_body, test_atomic_sub_fini },
-  { test_atomic_compare_exchange_init, test_atomic_compare_exchange_body,
-    test_atomic_compare_exchange_fini },
-  { test_atomic_or_and_init, test_atomic_or_and_body, test_atomic_or_and_fini },
+  {
+    test_atomic_add_init,
+    test_atomic_add_body,
+    test_atomic_add_fini
+  }, {
+    test_atomic_flag_init,
+    test_atomic_flag_body,
+    test_atomic_flag_fini
+  }, {
+    test_atomic_sub_init,
+    test_atomic_sub_body,
+    test_atomic_sub_fini
+  }, {
+    test_atomic_compare_exchange_init,
+    test_atomic_compare_exchange_body,
+    test_atomic_compare_exchange_fini
+  }, {
+    test_atomic_or_and_init,
+    test_atomic_or_and_body,
+    test_atomic_or_and_fini
+  },
 };
 
Index: testsuites/smptests/smpatomic08/smpatomic08.scn
===================================================================
--- testsuites/smptests/smpatomic08/smpatomic08.scn	(revision 7136d7f1afa09f8dba4f6c12cde2d012d5a29935)
+++ testsuites/smptests/smpatomic08/smpatomic08.scn	(revision 47b6fad01204a6a2f2a8d455cf396aeb00561d56)
@@ -1,22 +1,22 @@
 *** TEST SMPATOMIC 8 ***
 === atomic add test case ==
-atomic add worker 0 counter: 18583
-atomic add worker 1 counter: 36324
-global counter: expected = 54907, actual = 54907
-=== atomic flag test case ===
-atomic flag worker 0 counter: 7388
-atomic flag worker 1 counter: 17280
-global flag counter: expected = 24668, actual = 24668
+worker 0 value: 16686
+worker 1 value: 36405
+atomic value: expected = 53091, actual = 53091
+=== atomic flag test case ==
+worker 0 value: 5588
+worker 1 value: 16019
+atomic value: expected = 21607, actual = 21607
 === atomic sub test case ==
-atomic sub worker 0 counter: 18583
-atomic sub worker 1 counter: 36324
-global counter: expected = 54907, actual = 54907
-=== atomic compare_exchange test case ==
-atomic compare_exchange worker 0 counter: 3467
-atomic compare_exchange worker 1 counter: 19635
-global counter: expected = 23102, actual = 23102
-=== atomic or_and test case ==
-atomic or_and worker 0 counter: 1
-atomic or_and worker 1 counter: 1
-global counter: expected = 3, actual = 3
+worker 0 value: 4294950967
+worker 1 value: 4294930886
+atomic value: expected = 4294914557, actual = 4294914557
+=== atomic compare exchange test case ==
+worker 0 value: 2950
+worker 1 value: 22456
+atomic value: expected = 25406, actual = 25406
+=== atomic or/and test case ==
+worker 0 value: 1
+worker 1 value: 0
+atomic value: expected = 1, actual = 1
 *** END OF TEST SMPATOMIC 8 ***
