1 /* { dg-do compile } */
2 /* { dg-require-effective-target powerpc_prefixed_addr } */
3 /* { dg-require-effective-target lp64 } */
4 /* { dg-options "-O2 -mdejagnu-cpu=power10" } */
5 /* If -mstrict-align is enabled by default, we don't get the expected opcodes.
6 { dg-additional-options "-mno-strict-align" { target opt_mstrict_align } } */
8 /* Tests whether we generate a prefixed load/store operation for addresses that
9 don't meet DS/DQ offset constraints. 64-bit is needed for testing the use
10 of the PLWA instruciton. */
14 long long pad
; /* offset 0 bytes. */
15 unsigned char pad_uc
; /* offset 8 bytes. */
16 unsigned char uc
; /* offset 9 bytes. */
18 unsigned char pad_sc
[sizeof (long long) - sizeof (unsigned char)];
19 unsigned char sc
; /* offset 17 bytes. */
21 unsigned char pad_us
[sizeof (long long) - sizeof (signed char)];
22 unsigned short us
; /* offset 25 bytes. */
24 unsigned char pad_ss
[sizeof (long long) - sizeof (unsigned short)];
25 short ss
; /* offset 33 bytes. */
27 unsigned char pad_ui
[sizeof (long long) - sizeof (short)];
28 unsigned int ui
; /* offset 41 bytes. */
30 unsigned char pad_si
[sizeof (long long) - sizeof (unsigned int)];
31 unsigned int si
; /* offset 49 bytes. */
33 unsigned char pad_f
[sizeof (long long) - sizeof (int)];
34 float f
; /* offset 57 bytes. */
36 unsigned char pad_d
[sizeof (long long) - sizeof (float)];
37 double d
; /* offset 65 bytes. */
38 __float128 f128
; /* offset 73 bytes. */
39 } __attribute__((packed
));
42 load_uc (struct packed_struct
*p
)
44 return p
->uc
; /* LBZ 3,9(3). */
48 load_sc (struct packed_struct
*p
)
50 return p
->sc
; /* LBZ 3,17(3) + EXTSB 3,3. */
54 load_us (struct packed_struct
*p
)
56 return p
->us
; /* LHZ 3,25(3). */
60 load_ss (struct packed_struct
*p
)
62 return p
->ss
; /* LHA 3,33(3). */
66 load_ui (struct packed_struct
*p
)
68 return p
->ui
; /* LWZ 3,41(3). */
72 load_si (struct packed_struct
*p
)
74 return p
->si
; /* PLWA 3,49(3). */
78 load_float (struct packed_struct
*p
)
80 return p
->f
; /* LFS 1,57(3). */
84 load_double (struct packed_struct
*p
)
86 return p
->d
; /* LFD 1,65(3). */
90 load_float128 (struct packed_struct
*p
)
92 return p
->f128
; /* PLXV 34,73(3). */
96 store_uc (struct packed_struct
*p
, unsigned char uc
)
98 p
->uc
= uc
; /* STB 4,9(3). */
102 store_sc (struct packed_struct
*p
, signed char sc
)
104 p
->sc
= sc
; /* STB 4,17(3). */
108 store_us (struct packed_struct
*p
, unsigned short us
)
110 p
->us
= us
; /* STH 4,25(3). */
114 store_ss (struct packed_struct
*p
, signed short ss
)
116 p
->ss
= ss
; /* STH 4,33(3). */
120 store_ui (struct packed_struct
*p
, unsigned int ui
)
122 p
->ui
= ui
; /* STW 4,41(3). */
126 store_si (struct packed_struct
*p
, signed int si
)
128 p
->si
= si
; /* STW 4,49(3). */
132 store_float (struct packed_struct
*p
, float f
)
134 p
->f
= f
; /* STFS 1,57(3). */
138 store_double (struct packed_struct
*p
, double d
)
140 p
->d
= d
; /* STFD 1,65(3). */
144 store_float128 (struct packed_struct
*p
, __float128 f128
)
146 p
->f128
= f128
; /* PSTXV 34,1(3). */
149 /* { dg-final { scan-assembler-times {\mextsb\M} 1 } } */
150 /* { dg-final { scan-assembler-times {\mlbz\M} 2 } } */
151 /* { dg-final { scan-assembler-times {\mlfd\M} 1 } } */
152 /* { dg-final { scan-assembler-times {\mlfs\M} 1 } } */
153 /* { dg-final { scan-assembler-times {\mlha\M} 1 } } */
154 /* { dg-final { scan-assembler-times {\mlhz\M} 1 } } */
155 /* { dg-final { scan-assembler-times {\mlwz\M} 1 } } */
156 /* { dg-final { scan-assembler-times {\mplwa\M} 1 } } */
157 /* { dg-final { scan-assembler-times {\mplxv\M} 1 } } */
158 /* { dg-final { scan-assembler-times {\mpstxv\M} 1 } } */
159 /* { dg-final { scan-assembler-times {\mstb\M} 2 } } */
160 /* { dg-final { scan-assembler-times {\mstfd\M} 1 } } */
161 /* { dg-final { scan-assembler-times {\mstfs\M} 1 } } */
162 /* { dg-final { scan-assembler-times {\msth\M} 2 } } */
163 /* { dg-final { scan-assembler-times {\mstw\M} 2 } } */