[ARM] Fix test armv8_2-fp16-move-1.c
[official-gcc.git] / gcc / testsuite / gcc.target / arm / pr50305.c
blob2f6ad5cfeabf99ae0fce592e533c9f8c56a4df39
1 /* { dg-do compile } */
2 /* { dg-skip-if "incompatible options" { arm*-*-* } { "-march=*" } { "-march=armv7-a" } } */
3 /* { dg-options "-O2 -fno-omit-frame-pointer -marm -march=armv7-a -mfpu=vfp3" } */
5 struct event {
6 unsigned long long id;
7 unsigned int flag;
8 };
10 void dummy(void)
12 /* This is here to ensure that the offset of perf_event_id below
13 relative to the LANCHOR symbol exceeds the allowed displacement. */
14 static int __warned[300];
15 __warned[0] = 1;
18 extern void *kmem_cache_alloc_trace (void *cachep);
19 extern void *cs_cachep;
20 extern int nr_cpu_ids;
22 struct event *
23 event_alloc (int cpu)
25 static unsigned long long __attribute__((aligned(8))) perf_event_id;
26 struct event *event;
27 unsigned long long result;
28 unsigned long tmp;
30 if (cpu >= nr_cpu_ids)
31 return 0;
33 event = kmem_cache_alloc_trace (cs_cachep);
35 __asm__ __volatile__ ("dmb" : : : "memory");
37 __asm__ __volatile__("@ atomic64_add_return\n"
38 "1: ldrexd %0, %H0, [%3]\n"
39 " adds %0, %0, %4\n"
40 " adc %H0, %H0, %H4\n"
41 " strexd %1, %0, %H0, [%3]\n"
42 " teq %1, #0\n"
43 " bne 1b"
44 : "=&r" (result), "=&r" (tmp), "+Qo" (perf_event_id)
45 : "r" (&perf_event_id), "r" (1LL)
46 : "cc");
48 __asm__ __volatile__ ("dmb" : : : "memory");
50 event->id = result;
52 if (cpu)
53 event->flag = 1;
55 for (cpu = 0; cpu < nr_cpu_ids; cpu++)
56 kmem_cache_alloc_trace (cs_cachep);
58 return event;