On 2024-04-30 17:11, Richard Earnshaw (lists) wrote:
On 27/04/2024 15:13, Torbjörn SVENSSON wrote: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. 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. Signed-off-by: Torbjörn SVENSSON <[email protected]> --- .../gcc.target/arm/cmse/extend-param.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.target/arm/cmse/extend-param.c b/gcc/testsuite/gcc.target/arm/cmse/extend-param.c index 01fac786238..b8b8ecbff56 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/extend-param.c +++ b/gcc/testsuite/gcc.target/arm/cmse/extend-param.c @@ -93,4 +93,22 @@ __attribute__((cmse_nonsecure_entry)) char boolSecureFunc (bool index) { 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]; + +}Ok, but please can you add '-fshort-enums' to dg-options to ensure this test still behaves correctly if run with a different default (I missed that last time around).
Ok, I'll add that to extend-param.c. Do you want me to also add it to the extend-return.c test case?
Kind regards, Torbjörn
