When registering the tuple type in register_tuple_type, the
TYPE_ALIGN (tuple_type) will be changed by -fpack-struct=n. We need to
maintain natural alignment in handle_arm_sve_h.
2020-06-10 Haijian Zhang <z.zhanghaijian@huawei.com>
gcc/
PR target/95523
* config/aarch64/aarch64-sve-builtins.h
(sve_switcher::m_old_maximum_field_alignment): New member.
* config/aarch64/aarch64-sve-builtins.cc
(sve_switcher::sve_switcher): Save maximum_field_alignment in
m_old_maximum_field_alignment and clear maximum_field_alignment.
(sve_switcher::~sve_switcher): Restore maximum_field_alignment.
gcc/testsuite/
PR target/95523
* gcc.target/aarch64/sve/pr95523.c: New test.
aarch64_isa_flags = (AARCH64_FL_FP | AARCH64_FL_SIMD | AARCH64_FL_F16
| AARCH64_FL_SVE);
+ m_old_maximum_field_alignment = maximum_field_alignment;
+ maximum_field_alignment = 0;
+
m_old_general_regs_only = TARGET_GENERAL_REGS_ONLY;
global_options.x_target_flags &= ~MASK_GENERAL_REGS_ONLY;
if (m_old_general_regs_only)
global_options.x_target_flags |= MASK_GENERAL_REGS_ONLY;
aarch64_isa_flags = m_old_isa_flags;
+ maximum_field_alignment = m_old_maximum_field_alignment;
}
function_builder::function_builder ()
private:
unsigned long m_old_isa_flags;
+ unsigned int m_old_maximum_field_alignment;
bool m_old_general_regs_only;
bool m_old_have_regs_of_mode[MAX_MACHINE_MODE];
};
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fpack-struct=2" } */
+
+#include <arm_sve.h>
+
+void foo ()
+{
+ // Do nothing
+}
+