Lines Matching full:alignment
1 // C++-specific checks for the alignment builtins
17 template <typename T, long Alignment, long ArraySize = 16>
20 …rt(__is_same(decltype(__builtin_align_up(array, Alignment)), T *), // expected-error{{requested al… in test_templated_arguments()
22 static_assert(__is_same(decltype(__builtin_align_down(array, Alignment)), T *), in test_templated_arguments()
24 static_assert(__is_same(decltype(__builtin_is_aligned(array, Alignment)), bool), in test_templated_arguments()
26 T *x1 = __builtin_align_up(array, Alignment); in test_templated_arguments()
27 T *x2 = __builtin_align_down(array, Alignment); in test_templated_arguments()
28 bool x3 = __builtin_align_up(array, Alignment); in test_templated_arguments()
36 test_templated_arguments<int, 7>(); // invalid alignment value in test()
43 …pe(__builtin_align_up(array, 31)), int *), // expected-error{{requested alignment is not a power o… in test_incorrect_alignment_without_instatiation()
45 …e(__builtin_align_down(array, 7)), int *), // expected-error{{requested alignment is not a power o… in test_incorrect_alignment_without_instatiation()
47 …e(__builtin_is_aligned(array, -1)), bool), // expected-error{{requested alignment must be 1 or gre… in test_incorrect_alignment_without_instatiation()
50 __builtin_align_up(array, 31); // expected-error{{requested alignment is not a power of 2}} in test_incorrect_alignment_without_instatiation()
51 __builtin_align_down(array, 31); // expected-error{{requested alignment is not a power of 2}} in test_incorrect_alignment_without_instatiation()
52 __builtin_align_up(array, 31); // expected-error{{requested alignment is not a power of 2}} in test_incorrect_alignment_without_instatiation()
56 …__builtin_align_up(array, sizeof(sizeof(value)) - 1); // expected-error{{requested alignment is no… in test_incorrect_alignment_without_instatiation()
57 __builtin_align_up(array, value); // no diagnostic as the alignment is value dependent. in test_incorrect_alignment_without_instatiation()
106 // expected-note@-1{{requested alignment -3 is not a positive power of two}} in wrap_is_aligned()
107 // expected-note@-2{{requested alignment 19 is not a positive power of two}} in wrap_is_aligned()
108 // expected-note@-3{{requested alignment must be 128 or less for type 'char'; 4194304 is invalid}} in wrap_is_aligned()
113 // expected-note@-1{{requested alignment -2 is not a positive power of two}} in wrap_align_up()
114 // expected-note@-2{{requested alignment 18 is not a positive power of two}} in wrap_align_up()
115 …// expected-note@-3{{requested alignment must be 2147483648 or less for type 'int'; 8589934592 is … in wrap_align_up()
122 // expected-note@-1{{requested alignment -1 is not a positive power of two}} in wrap_align_down()
123 // expected-note@-2{{requested alignment 17 is not a positive power of two}} in wrap_align_down()
124 …// expected-note@-3{{requested alignment must be 32768 or less for type 'short'; 1048576 is invali… in wrap_align_down()
169 // that are known to have greater alignment:
173 // But it can not be evaluated if the alignment is greater than the minimum
174 // known alignment, since in that case the value might be the same if it happens
177 // expected-note@-1{{cannot constant evaluate the result of adjusting alignment to 64}}
179 // expected-note@-1{{cannot constant evaluate the result of adjusting alignment to 64}}
181 // However, we can compute in case the requested alignment is less than the
182 // base alignment:
208 // expected-note@-1{{cannot constant evaluate the result of adjusting alignment to 64}}
216 // expected-note@-1{{cannot constant evaluate whether run-time alignment is at least 64}}
218 // However, if the alignment being checked is less than the minimum alignment of
219 // the base object we can check the low bits of the alignment:
229 // expected-note@-1{{cannot constant evaluate the result of adjusting alignment to 64}}
231 // Check different source and alignment type widths are handled correctly.