[AArch64] Backport to gcc-7 PR71727 fix -mstrict-align

2017-10-06  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
	Backport from mainline r253242.
	2017-09-27  Christophe Lyon  <christophe.lyon@linaro.org>

	PR target/71727
	* config/aarch64/aarch64.c
	(aarch64_builtin_support_vector_misalignment): Always return false
	when misalignment is unknown.

	gcc/testsuite/
	Backport from mainline r253251.
	2017-09-27  Christophe Lyon  <christophe.lyon@linaro.org>

	PR target/71727
	* gcc.target/aarch64/pr71727-2.c: New test.

From-SVN: r253477
This commit is contained in:
Christophe Lyon 2017-10-06 07:38:51 +00:00 committed by Christophe Lyon
parent 32fe08bb83
commit 1e28109018
4 changed files with 36 additions and 12 deletions

View File

@ -1,3 +1,13 @@
2017-10-06 Christophe Lyon <christophe.lyon@linaro.org>
Backport from mainline r253242.
2017-09-27 Christophe Lyon <christophe.lyon@linaro.org>
PR target/71727
* config/aarch64/aarch64.c
(aarch64_builtin_support_vector_misalignment): Always return false
when misalignment is unknown.
2017-10-04 Jason Merrill <jason@redhat.com>
PR c++/82406 - C++ error with noexcept function type

View File

@ -11509,19 +11509,9 @@ aarch64_builtin_support_vector_misalignment (machine_mode mode,
if (optab_handler (movmisalign_optab, mode) == CODE_FOR_nothing)
return false;
/* Misalignment factor is unknown at compile time. */
if (misalignment == -1)
{
/* Misalignment factor is unknown at compile time but we know
it's word aligned. */
if (aarch64_simd_vector_alignment_reachable (type, is_packed))
{
int element_size = TREE_INT_CST_LOW (TYPE_SIZE (type));
if (element_size != 64)
return true;
}
return false;
}
return false;
}
return default_builtin_support_vector_misalignment (mode, type, misalignment,
is_packed);

View File

@ -1,3 +1,11 @@
2017-10-06 Christophe Lyon <christophe.lyon@linaro.org>
Backport from mainline r253251.
2017-09-27 Christophe Lyon <christophe.lyon@linaro.org>
PR target/71727
* gcc.target/aarch64/pr71727-2.c: New test.
2017-10-03 Thomas Koenig <tkoenig@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>

View File

@ -0,0 +1,16 @@
/* { dg-do compile } */
/* { dg-options "-mstrict-align -O3" } */
unsigned char foo(const unsigned char *buffer, unsigned int length)
{
unsigned char sum;
unsigned int count;
for (sum = 0, count = 0; count < length; count++) {
sum = (unsigned char) (sum + *(buffer + count));
}
return sum;
}
/* { dg-final { scan-assembler-times "and\tw\[0-9\]+, w\[0-9\]+, 15" 1 } } */