https://gcc.gnu.org/g:08ca81e4b49bda153d678a372df7f7143a94f4ad

commit r11-11443-g08ca81e4b49bda153d678a372df7f7143a94f4ad
Author: Torbjörn SVENSSON <torbjorn.svens...@foss.st.com>
Date:   Sat Apr 27 15:57:27 2024 +0200

    testsuite: Verify r0-r3 are extended with CMSE
    
    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.svens...@foss.st.com>
    
    (cherry picked from commit 9ddad76e98ac8f257f90b3814ed3c6ba78d0f3c7)

Diff:
---
 gcc/testsuite/gcc.target/arm/cmse/extend-param.c  | 21 +++++++++++++++++----
 gcc/testsuite/gcc.target/arm/cmse/extend-return.c |  4 ++--
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/gcc.target/arm/cmse/extend-param.c 
b/gcc/testsuite/gcc.target/arm/cmse/extend-param.c
index 01fac786238..d01ef87e0be 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/extend-param.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/extend-param.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-mcmse" } */
+/* { dg-options "-mcmse -fshort-enums" } */
 /* { dg-final { check-function-bodies "**" "" "" } } */
 
 #include <arm_cmse.h>
@@ -78,7 +78,6 @@ __attribute__((cmse_nonsecure_entry)) char enumSecureFunc 
(enum offset index) {
   if (index >= ARRAY_SIZE)
     return 0;
   return array[index];
-
 }
 
 /*
@@ -88,9 +87,23 @@ __attribute__((cmse_nonsecure_entry)) char enumSecureFunc 
(enum offset 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];
+}
diff --git a/gcc/testsuite/gcc.target/arm/cmse/extend-return.c 
b/gcc/testsuite/gcc.target/arm/cmse/extend-return.c
index cf731ed33df..081de0d699f 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/extend-return.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/extend-return.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-mcmse" } */
+/* { dg-options "-mcmse -fshort-enums" } */
 /* { dg-final { check-function-bodies "**" "" "" } } */
 
 #include <arm_cmse.h>
@@ -89,4 +89,4 @@ unsigned char __attribute__((noipa)) enumNonsecure0 
(ns_enum_foo_t * ns_foo_p)
 unsigned char boolNonsecure0 (ns_bool_foo_t * ns_foo_p)
 {
   return ns_foo_p ();
-}
\ No newline at end of file
+}

Reply via email to