RISC-V: testsuite: Fix SELECT_VL SLP fallout.
[official-gcc.git] / gcc / testsuite / gcc.target / arm / pr50305.c
blobf93df9f4e7e03411ef79e1cb42098df01709fdfe
1 /* { dg-do compile } */
2 /* { dg-skip-if "incompatible options" { arm*-*-* } { "-march=*" } { "-march=armv7-a" } } */
3 /* { dg-skip-if "-mpure-code supports M-profile only" { *-*-* } { "-mpure-code" } } */
4 /* { dg-options "-O2 -fno-omit-frame-pointer -marm -march=armv7-a -mfpu=vfp3" } */
6 struct event {
7 unsigned long long id;
8 unsigned int flag;
9 };
11 void dummy(void)
13 /* This is here to ensure that the offset of perf_event_id below
14 relative to the LANCHOR symbol exceeds the allowed displacement. */
15 static int __warned[300];
16 __warned[0] = 1;
19 extern void *kmem_cache_alloc_trace (void *cachep);
20 extern void *cs_cachep;
21 extern int nr_cpu_ids;
23 struct event *
24 event_alloc (int cpu)
26 static unsigned long long __attribute__((aligned(8))) perf_event_id;
27 struct event *event;
28 unsigned long long result;
29 unsigned long tmp;
31 if (cpu >= nr_cpu_ids)
32 return 0;
34 event = kmem_cache_alloc_trace (cs_cachep);
36 __asm__ __volatile__ ("dmb" : : : "memory");
38 __asm__ __volatile__("@ atomic64_add_return\n"
39 "1: ldrexd %0, %H0, [%3]\n"
40 " adds %0, %0, %4\n"
41 " adc %H0, %H0, %H4\n"
42 " strexd %1, %0, %H0, [%3]\n"
43 " teq %1, #0\n"
44 " bne 1b"
45 : "=&r" (result), "=&r" (tmp), "+Qo" (perf_event_id)
46 : "r" (&perf_event_id), "r" (1LL)
47 : "cc");
49 __asm__ __volatile__ ("dmb" : : : "memory");
51 event->id = result;
53 if (cpu)
54 event->flag = 1;
56 for (cpu = 0; cpu < nr_cpu_ids; cpu++)
57 kmem_cache_alloc_trace (cs_cachep);
59 return event;