Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/mma-alignment.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target hard_float } */
3 /* { dg-options "-O2 -mhard-float" } */
4
5 #include <stdlib.h>
6
7 /* The MMA types below are enabled for pre-power10 compiles, because the
8 built-ins that use them must always be initialized in case the user has
9 a target attribute or pragma on a function that uses the MMA built-ins.
10 Since the test below doesn't need any other MMA support, we can enable
11 this test case on basically any cpu that has hard floating point
12 registers. */
13
14 struct
15 {
16 int __attribute__ ((__aligned__)) ivar;
17 __vector_pair pair;
18 __vector_quad quad;
19 } s;
20
21 int
22 main (void)
23 {
24 /* Verify default alignment is 16-byte aligned (BIGGEST_ALIGNMENT).
25 This may change in the future, but that is an ABI break, so this
26 hardcoded test case is here to be a noisy FAIL as a warning, in
27 case the ABI change was unintended and unwanted. An example of where
28 this can break an ABI is in glibc's struct _Unwind_Exception. */
29 if (__alignof__ (s.ivar) != 16)
30 abort ();
31
32 /* Verify __vector_pair types are 32-byte aligned. */
33 if (__alignof__ (s.pair) != 32)
34 abort ();
35
36 /* Verify __vector_quad types are 64-byte aligned. */
37 if (__alignof__ (s.quad) != 64)
38 abort ();
39
40 return 0;
41 }