1 /* { dg-do compile } */
2 /* { dg-require-ifunc "" } */
3 /* { dg-require-effective-target aarch64_variant_pcs } */
4 
5 /* Test that .variant_pcs is emitted for vector PCS symbol references.  */
6 
7 #define ATTR __attribute__ ((aarch64_vector_pcs))
8 
f_local_basepcs(void)9 static void f_local_basepcs (void)
10 {
11 }
12 
f_ifunc_basepcs_resolver()13 static void (*f_ifunc_basepcs_resolver ()) (void)
14 {
15   return (void (*)(void))f_local_basepcs;
16 }
17 
18 __attribute__ ((ifunc ("f_ifunc_basepcs_resolver")))
19 void f_ifunc_basepcs (void);
20 
f_local_vpcs(void)21 ATTR static void f_local_vpcs (void)
22 {
23 }
24 
f_ifunc_vpcs_resolver()25 static void (*f_ifunc_vpcs_resolver ()) (void)
26 {
27   return (void (*)(void))f_local_vpcs;
28 }
29 
30 __attribute__ ((ifunc ("f_ifunc_vpcs_resolver")))
31 ATTR void f_ifunc_vpcs (void);
32 
33 __attribute__ ((visibility ("hidden")))
34 __attribute__ ((ifunc ("f_ifunc_vpcs_resolver")))
35 ATTR void f_hidden_ifunc_vpcs (void);
36 
37 __attribute__ ((ifunc ("f_ifunc_vpcs_resolver")))
38 ATTR static void f_local_ifunc_vpcs (void);
39 
40 void (*refs_basepcs[]) (void) = {
41 	f_ifunc_basepcs,
42 };
43 
44 void (*ATTR refs_vpcs[]) (void) = {
45 	f_ifunc_vpcs,
46 	f_hidden_ifunc_vpcs,
47 	f_local_ifunc_vpcs,
48 };
49 
50 /* Note: local symbols don't need .variant_pcs, but gcc generates it, so
51    we check them here.  */
52 
53 /* { dg-final { scan-assembler-not {\.variant_pcs\tf_local_basepcs} } } */
54 /* { dg-final { scan-assembler-not {\.variant_pcs\tf_ifunc_basepcs} } } */
55 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_local_vpcs} 1 } } */
56 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_ifunc_vpcs} 1 } } */
57 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_hidden_ifunc_vpcs} 1 } } */
58 /* { dg-final { scan-assembler-times {\.variant_pcs\tf_local_ifunc_vpcs} 1 } } */
59