Commit 43646ce3 by Richard Earnshaw Committed by Richard Earnshaw

[arm] Further fixes for PR88469

A bitfield that is exactly the same size as an integral type and
naturally aligned will have DECL_BIT_FIELD cleared.  So we need to
check DECL_BIT_FIELD_TYPE to be sure whether or not the underlying
type was declared with a bitfield declaration.

I've also added a test for bitfields that are based on overaligned types.

	PR target/88469
gcc:
	* config/arm/arm.c (arm_needs_double_word_align): Check
	DECL_BIT_FIELD_TYPE.

gcc/testsuite:
	* gcc.target/arm/aapcs/bitfield2.c: New test.
	* gcc.target/arm/aapcs/bitfield3.c: New test.

From-SVN: r268160
parent df69e824
2019-01-22 Richard Earnshaw <rearnsha@arm.com>
PR target/88469
* config/arm/arm.c (arm_needs_double_word_align): Check
DECL_BIT_FIELD_TYPE.
2019-01-22 Hongtao Liu <hongtao.liu@intel.com>
H.J. Lu <hongjiu.lu@intel.com>
......
......@@ -6634,7 +6634,7 @@ arm_needs_doubleword_align (machine_mode mode, const_tree type)
ret = -1;
}
else if (TREE_CODE (field) == FIELD_DECL
&& DECL_BIT_FIELD (field)
&& DECL_BIT_FIELD_TYPE (field)
&& TYPE_ALIGN (DECL_BIT_FIELD_TYPE (field)) > PARM_BOUNDARY)
ret2 = 1;
......
2019-01-22 Richard Earnshaw <rearnsha@arm.com>
PR target/88469
* gcc.target/arm/aapcs/bitfield2.c: New test.
* gcc.target/arm/aapcs/bitfield3.c: New test.
2019-01-22 Wilco Dijkstra <wdijkstr@arm.com>
PR rtl-optimization/87763
......
/* Test AAPCS layout (alignment). */
/* { dg-do run { target arm_eabi } } */
/* { dg-require-effective-target arm32 } */
/* { dg-options "-O" } */
#ifndef IN_FRAMEWORK
#define TESTFILE "bitfield2.c"
typedef unsigned int alint __attribute__((aligned (8)));
struct bf
{
alint a: 17;
alint b: 15;
} v = {1, 1};
#include "abitest.h"
#else
ARG (int, 7, R0)
ARG (int, 9, R1)
ARG (int, 11, R2)
/* Alignment of the bitfield type should affect alignment of the overall
type, so R3 not used. */
LAST_ARG (struct bf, v, STACK)
#endif
/* Test AAPCS layout (alignment). */
/* { dg-do run { target arm_eabi } } */
/* { dg-require-effective-target arm32 } */
/* { dg-options "-O" } */
#ifndef IN_FRAMEWORK
#define TESTFILE "bitfield3.c"
struct bf
{
/* Internally this may be mapped to unsigned short. Ensure we still
check the original declaration. */
unsigned long long a: 16;
unsigned b: 3;
} v = {1, 3};
#include "abitest.h"
#else
ARG (int, 7, R0)
ARG (int, 9, R1)
ARG (int, 11, R2)
/* Alignment of the bitfield type should affect alignment of the overall
type, so R3 not used. */
LAST_ARG (struct bf, v, STACK)
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment