15 static void check(const struct S
*s
, unsigned e
,
16 const char *which
, const char *insn
, int ofs
)
21 fprintf(stderr
, "%s %s %d: garbage before word 0x%08x\n",
22 which
, insn
, ofs
, s
->a
);
26 fprintf(stderr
, "%s %s %d: garbage after word 0x%08x\n",
27 which
, insn
, ofs
, s
->c
);
31 fprintf(stderr
, "%s %s %d: 0x%08x != 0x%08x\n",
32 which
, insn
, ofs
, s
->b
, e
);
41 #define TEST(INSN, OFS, E) \
44 asm volatile(INSN " %1, " #OFS "(%0)" \
45 : : "r"(&s.b), "r" (0x11223344) : "memory"); \
46 check(&s, E, which, INSN, OFS); \
49 static void test(const char *which
)
53 TEST("stby,b", 0, 0x11223344);
54 TEST("stby,b", 1, 0x00223344);
55 TEST("stby,b", 2, 0x00003344);
56 TEST("stby,b", 3, 0x00000044);
58 TEST("stby,e", 0, 0x00000000);
59 TEST("stby,e", 1, 0x11000000);
60 TEST("stby,e", 2, 0x11220000);
61 TEST("stby,e", 3, 0x11223300);
64 static void *child(void *x
)
74 /* Run test in serial mode */
77 /* Create a dummy thread to start parallel mode. */
78 err
= pthread_create(&thr
, NULL
, child
, NULL
);
80 fprintf(stderr
, "pthread_create: %s\n", strerror(err
));
84 /* Run test in parallel mode */