padding_bits_to_clear[max_reg]
|= padding_bits_to_clear_res[max_reg] & mask;
+ for (int i = *regno; i < max_reg; ++i)
+ not_to_clear_reg_mask |= HOST_WIDE_INT_1U << i;
+
*regno = max_reg;
*last_used_bit = max_bit;
}
--- /dev/null
+
+/* { dg-do compile } */
+/* { dg-options "-mcmse" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include "../union-3.x"
+
+/*
+** fn_caller_0:
+** ...
+** lsrs r4, r4, #1
+** lsls r4, r4, #1
+** movs r2, r4
+** movs r3, r4
+** bl __gnu_cmse_nonsecure_call
+** ...
+*/
+
+/*
+** fn_caller_1:
+** ...
+** lsrs r4, r4, #1
+** lsls r4, r4, #1
+** movs r1, r4
+** movs r2, r4
+** movs r3, r4
+** bl __gnu_cmse_nonsecure_call
+** ...
+*/
--- /dev/null
+
+/* { dg-do compile } */
+/* { dg-options "-mcmse" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include "../../union-3.x"
+
+/*
+** fn_caller_0:
+** ...
+** lsrs r3, r3, #1
+** lsls r3, r3, #1
+** push {r4, r5, r6, r7, r8, r9, r10, fp}
+This test is not meant to be to test the FP clearing, so accept any, preventing
+the need to specialize the test further for different float-abi's
+** ...
+** clrm {r2, r4, r5, r6, r7, r8, r9, r10, fp, ip, APSR}
+** blxns r3
+** ...
+*/
+
+/*
+** fn_caller_1:
+** ...
+** lsrs r3, r3, #1
+** lsls r3, r3, #1
+** push {r4, r5, r6, r7, r8, r9, r10, fp}
+** ...
+** clrm {r1, r2, r4, r5, r6, r7, r8, r9, r10, fp, ip, APSR}
+** blxns r3
+** ...
+*/
--- /dev/null
+
+/* { dg-do compile } */
+/* { dg-options "-mcmse" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include "../../union-3.x"
+
+/*
+** fn_caller_0:
+** ...
+** lsrs r4, r4, #1
+** lsls r4, r4, #1
+** mov r2, r4
+** mov r3, r4
+This test is not meant to be to test the FP clearing, so accept any, preventing
+the need to specialize the test further for different float-abi's
+** ...
+** bl __gnu_cmse_nonsecure_call
+** ...
+*/
+
+/*
+** fn_caller_1:
+** ...
+** lsrs r4, r4, #1
+** lsls r4, r4, #1
+** mov r1, r4
+** mov r2, r4
+** mov r3, r4
+** ...
+** bl __gnu_cmse_nonsecure_call
+** ...
+*/
--- /dev/null
+#include <arm_cmse.h>
+
+union u_t_0 {
+ long long ll;
+};
+
+typedef void(__attribute__((cmse_nonsecure_call)) fn_t_0)(union u_t_0);
+
+void fn_caller_0(fn_t_0 *f_ptr) {
+ union u_t_0 x = {1234};
+ f_ptr(x);
+}
+
+union u_t_1 {
+ long int l;
+};
+
+typedef void(__attribute__((cmse_nonsecure_call)) fn_t_1)(union u_t_1);
+
+void fn_caller_1(fn_t_1 *f_ptr) {
+ union u_t_1 x = {1234};
+ f_ptr(x);
+}