Add regression test to the existing zero/sign extend tests for CMSE to
verify that r0, r1, r2 and r3 are properly extended, not just r0.
boolCharShortEnumSecureFunc test is done using -O0 to ensure the
instructions are in a predictable order.
gcc/testsuite/ChangeLog:
* gcc.target/arm/cmse/extend-param.c: Add regression test. Add
-fshort-enums.
* gcc.target/arm/cmse/extend-return.c: Add -fshort-enums option.
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
/* { dg-do compile } */
-/* { dg-options "-mcmse" } */
+/* { dg-options "-mcmse -fshort-enums" } */
/* { dg-final { check-function-bodies "**" "" "" } } */
#include <arm_cmse.h>
if (index >= ARRAY_SIZE)
return 0;
return array[index];
-
}
/*
** ...
*/
__attribute__((cmse_nonsecure_entry)) char boolSecureFunc (bool index) {
-
if (index >= ARRAY_SIZE)
return 0;
return array[index];
+}
-}
\ No newline at end of file
+/*
+**__acle_se_boolCharShortEnumSecureFunc:
+** ...
+** uxtb r0, r0
+** uxtb r1, r1
+** uxth r2, r2
+** uxtb r3, r3
+** ...
+*/
+__attribute__((cmse_nonsecure_entry,optimize(0))) char boolCharShortEnumSecureFunc (bool a, unsigned char b, unsigned short c, enum offset d) {
+ size_t index = a + b + c + d;
+ if (index >= ARRAY_SIZE)
+ return 0;
+ return array[index];
+}
/* { dg-do compile } */
-/* { dg-options "-mcmse" } */
+/* { dg-options "-mcmse -fshort-enums" } */
/* { dg-final { check-function-bodies "**" "" "" } } */
#include <arm_cmse.h>
unsigned char boolNonsecure0 (ns_bool_foo_t * ns_foo_p)
{
return ns_foo_p ();
-}
\ No newline at end of file
+}