From 9e72bc908653976e2e374e51ec6d7331cfdd0b72 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 10 Nov 2017 18:20:33 +0000 Subject: [PATCH] [testsuite/ARM] Consolidate sources for cmse tests For the most part, testcases under gcc.target/arm/cmse/baseline and gcc.target/arm/cmse/mainline are duplicate copies with only different dejagnu directives. Although there is no requirement for them to be similar, having them both identical allow to compare the code generated and make it easier in case of change in code generation to both architecture to update the testcases (if one needs updating so does the other). Similarly all the tests in gcc.target/arm/cmse/mainline/ have the same source but are duplicate copies. This patch moves all the code in the tests to a parent directory: gcc.target/arm/cmse for tests shared by Armv8-M Baseline and Mainline and gcc.target/arm/cmse/mainline for tests *only* shared by the various float ABI of Armv8-M Mainline. C includes are then used where the code used to sit. Note that the cmse-13.c test used to differ slightly between architectures and float ABI tested in the first floating-point constant passed to bar: sometimes 1.0 and sometimes 3.0. This patch settles on 3.0 to not confuse with the 1.0 constant used to clear VFP registers in some of the configurations. 2017-11-10 Thomas Preud'homme gcc/testsuite/ * gcc.target/arm/cmse/bitfield-4.x: New file. * gcc.target/arm/cmse/baseline/bitfield-4.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/bitfield-4.c: Likewise. * gcc.target/arm/cmse/bitfield-5.x: New file. * gcc.target/arm/cmse/baseline/bitfield-5.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/bitfield-5.c: Likewise. * gcc.target/arm/cmse/bitfield-6.x: New file. * gcc.target/arm/cmse/baseline/bitfield-6.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/bitfield-6.c: Likewise. * gcc.target/arm/cmse/bitfield-7.x: New file. * gcc.target/arm/cmse/baseline/bitfield-7.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/bitfield-7.c: Likewise. * gcc.target/arm/cmse/bitfield-8.x: New file. * gcc.target/arm/cmse/baseline/bitfield-8.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/bitfield-8.c: Likewise. * gcc.target/arm/cmse/bitfield-9.x: New file. * gcc.target/arm/cmse/baseline/bitfield-9.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/bitfield-9.c: Likewise. * gcc.target/arm/cmse/bitfield-and-union.x: New file. * gcc.target/arm/cmse/baseline/bitfield-and-union-1.c: Rename into ... * gcc.target/arm/cmse/baseline/bitfield-and-union.c: This. Remove code and include above bitfield-and-union.x file. * gcc.target/arm/cmse/mainline/bitfield-and-union-1.c: Rename into ... * gcc.target/arm/cmse/mainline/bitfield-and-union.c: this. Remove code and include above bitfield-and-union.x file. * gcc.target/arm/cmse/cmse-13.x: New file. * gcc.target/arm/cmse/baseline/cmse-13.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c: Likewise. * gcc.target/arm/cmse/mainline/hard/cmse-13.c: Likewise. * gcc.target/arm/cmse/mainline/soft/cmse-13.c: Likewise. * gcc.target/arm/cmse/mainline/softfp/cmse-13.c: Likewise. * gcc.target/arm/cmse/cmse-5.x: New file. * gcc.target/arm/cmse/mainline/hard-sp/cmse-5.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/hard/cmse-5.c: Likewise. * gcc.target/arm/cmse/mainline/soft/cmse-5.c: Likewise. * gcc.target/arm/cmse/mainline/softfp-sp/cmse-5.c: Likewise. * gcc.target/arm/cmse/mainline/softfp/cmse-5.c: Likewise. * gcc.target/arm/cmse/cmse-7.x: New file. * gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/hard/cmse-7.c: Likewise. * gcc.target/arm/cmse/mainline/soft/cmse-7.c: Likewise. * gcc.target/arm/cmse/mainline/softfp-sp/cmse-7.c: Likewise. * gcc.target/arm/cmse/mainline/softfp/cmse-7.c: Likewise. * gcc.target/arm/cmse/cmse-8.x: New file. * gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/hard/cmse-8.c: Likewise. * gcc.target/arm/cmse/mainline/soft/cmse-8.c: Likewise. * gcc.target/arm/cmse/mainline/softfp-sp/cmse-8.c: Likewise. * gcc.target/arm/cmse/mainline/softfp/cmse-8.c: Likewise. * gcc.target/arm/cmse/union-1.x: New file. * gcc.target/arm/cmse/baseline/union-1.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/union-1.c: Likewise. * gcc.target/arm/cmse/union-2.x: New file. * gcc.target/arm/cmse/baseline/union-2.c: Remove code and include above file. * gcc.target/arm/cmse/mainline/union-2.c: Likewise. From-SVN: r254633 --- gcc/testsuite/ChangeLog | 70 ++++++++++++++++ .../gcc.target/arm/cmse/baseline/bitfield-4.c | 41 +-------- .../gcc.target/arm/cmse/baseline/bitfield-5.c | 37 +-------- .../gcc.target/arm/cmse/baseline/bitfield-6.c | 46 +---------- .../gcc.target/arm/cmse/baseline/bitfield-7.c | 38 +-------- .../gcc.target/arm/cmse/baseline/bitfield-8.c | 40 +-------- .../gcc.target/arm/cmse/baseline/bitfield-9.c | 43 +--------- .../arm/cmse/baseline/bitfield-and-union-1.c | 96 ---------------------- .../arm/cmse/baseline/bitfield-and-union.c | 22 +++++ .../gcc.target/arm/cmse/baseline/cmse-13.c | 8 +- .../gcc.target/arm/cmse/baseline/union-1.c | 55 +------------ .../gcc.target/arm/cmse/baseline/union-2.c | 68 +-------------- gcc/testsuite/gcc.target/arm/cmse/bitfield-4.x | 40 +++++++++ gcc/testsuite/gcc.target/arm/cmse/bitfield-5.x | 36 ++++++++ gcc/testsuite/gcc.target/arm/cmse/bitfield-6.x | 45 ++++++++++ gcc/testsuite/gcc.target/arm/cmse/bitfield-7.x | 36 ++++++++ gcc/testsuite/gcc.target/arm/cmse/bitfield-8.x | 39 +++++++++ gcc/testsuite/gcc.target/arm/cmse/bitfield-9.x | 42 ++++++++++ ...bitfield-and-union-1.c => bitfield-and-union.x} | 19 ----- gcc/testsuite/gcc.target/arm/cmse/cmse-13.x | 7 ++ gcc/testsuite/gcc.target/arm/cmse/cmse-5.x | 7 ++ gcc/testsuite/gcc.target/arm/cmse/cmse-7.x | 7 ++ gcc/testsuite/gcc.target/arm/cmse/cmse-8.x | 7 ++ .../gcc.target/arm/cmse/mainline/bitfield-4.c | 41 +-------- .../gcc.target/arm/cmse/mainline/bitfield-5.c | 37 +-------- .../gcc.target/arm/cmse/mainline/bitfield-6.c | 46 +---------- .../gcc.target/arm/cmse/mainline/bitfield-7.c | 38 +-------- .../gcc.target/arm/cmse/mainline/bitfield-8.c | 40 +-------- .../gcc.target/arm/cmse/mainline/bitfield-9.c | 43 +--------- .../arm/cmse/mainline/bitfield-and-union.c | 20 +++++ .../gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c | 9 +- .../gcc.target/arm/cmse/mainline/hard-sp/cmse-5.c | 11 +-- .../gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c | 8 +- .../gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c | 8 +- .../gcc.target/arm/cmse/mainline/hard/cmse-13.c | 9 +- .../gcc.target/arm/cmse/mainline/hard/cmse-5.c | 11 +-- .../gcc.target/arm/cmse/mainline/hard/cmse-7.c | 8 +- .../gcc.target/arm/cmse/mainline/hard/cmse-8.c | 8 +- .../gcc.target/arm/cmse/mainline/soft/cmse-13.c | 8 +- .../gcc.target/arm/cmse/mainline/soft/cmse-5.c | 12 +-- .../gcc.target/arm/cmse/mainline/soft/cmse-7.c | 8 +- .../gcc.target/arm/cmse/mainline/soft/cmse-8.c | 8 +- .../arm/cmse/mainline/softfp-sp/cmse-5.c | 11 +-- .../arm/cmse/mainline/softfp-sp/cmse-7.c | 8 +- .../arm/cmse/mainline/softfp-sp/cmse-8.c | 8 +- .../gcc.target/arm/cmse/mainline/softfp/cmse-13.c | 8 +- .../gcc.target/arm/cmse/mainline/softfp/cmse-5.c | 11 +-- .../gcc.target/arm/cmse/mainline/softfp/cmse-7.c | 8 +- .../gcc.target/arm/cmse/mainline/softfp/cmse-8.c | 8 +- .../gcc.target/arm/cmse/mainline/union-1.c | 55 +------------ .../gcc.target/arm/cmse/mainline/union-2.c | 68 +-------------- gcc/testsuite/gcc.target/arm/cmse/union-1.x | 54 ++++++++++++ gcc/testsuite/gcc.target/arm/cmse/union-2.x | 67 +++++++++++++++ 53 files changed, 545 insertions(+), 983 deletions(-) delete mode 100644 gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-and-union-1.c create mode 100644 gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-and-union.c create mode 100644 gcc/testsuite/gcc.target/arm/cmse/bitfield-4.x create mode 100644 gcc/testsuite/gcc.target/arm/cmse/bitfield-5.x create mode 100644 gcc/testsuite/gcc.target/arm/cmse/bitfield-6.x create mode 100644 gcc/testsuite/gcc.target/arm/cmse/bitfield-7.x create mode 100644 gcc/testsuite/gcc.target/arm/cmse/bitfield-8.x create mode 100644 gcc/testsuite/gcc.target/arm/cmse/bitfield-9.x rename gcc/testsuite/gcc.target/arm/cmse/{mainline/bitfield-and-union-1.c => bitfield-and-union.x} (54%) create mode 100644 gcc/testsuite/gcc.target/arm/cmse/cmse-13.x create mode 100644 gcc/testsuite/gcc.target/arm/cmse/cmse-5.x create mode 100644 gcc/testsuite/gcc.target/arm/cmse/cmse-7.x create mode 100644 gcc/testsuite/gcc.target/arm/cmse/cmse-8.x create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-and-union.c create mode 100644 gcc/testsuite/gcc.target/arm/cmse/union-1.x create mode 100644 gcc/testsuite/gcc.target/arm/cmse/union-2.x diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 948c8b1..a6a4eac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,73 @@ +2017-11-10 Thomas Preud'homme + + * gcc.target/arm/cmse/bitfield-4.x: New file. + * gcc.target/arm/cmse/baseline/bitfield-4.c: Remove code and include + above file. + * gcc.target/arm/cmse/mainline/bitfield-4.c: Likewise. + * gcc.target/arm/cmse/bitfield-5.x: New file. + * gcc.target/arm/cmse/baseline/bitfield-5.c: Remove code and include + above file. + * gcc.target/arm/cmse/mainline/bitfield-5.c: Likewise. + * gcc.target/arm/cmse/bitfield-6.x: New file. + * gcc.target/arm/cmse/baseline/bitfield-6.c: Remove code and include + above file. + * gcc.target/arm/cmse/mainline/bitfield-6.c: Likewise. + * gcc.target/arm/cmse/bitfield-7.x: New file. + * gcc.target/arm/cmse/baseline/bitfield-7.c: Remove code and include + above file. + * gcc.target/arm/cmse/mainline/bitfield-7.c: Likewise. + * gcc.target/arm/cmse/bitfield-8.x: New file. + * gcc.target/arm/cmse/baseline/bitfield-8.c: Remove code and include + above file. + * gcc.target/arm/cmse/mainline/bitfield-8.c: Likewise. + * gcc.target/arm/cmse/bitfield-9.x: New file. + * gcc.target/arm/cmse/baseline/bitfield-9.c: Remove code and include + above file. + * gcc.target/arm/cmse/mainline/bitfield-9.c: Likewise. + * gcc.target/arm/cmse/bitfield-and-union.x: New file. + * gcc.target/arm/cmse/baseline/bitfield-and-union-1.c: Rename into ... + * gcc.target/arm/cmse/baseline/bitfield-and-union.c: This. Remove code + and include above bitfield-and-union.x file. + * gcc.target/arm/cmse/mainline/bitfield-and-union-1.c: Rename into ... + * gcc.target/arm/cmse/mainline/bitfield-and-union.c: this. Remove code + and include above bitfield-and-union.x file. + * gcc.target/arm/cmse/cmse-13.x: New file. + * gcc.target/arm/cmse/baseline/cmse-13.c: Remove code and include above + file. + * gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c: Likewise. + * gcc.target/arm/cmse/mainline/hard/cmse-13.c: Likewise. + * gcc.target/arm/cmse/mainline/soft/cmse-13.c: Likewise. + * gcc.target/arm/cmse/mainline/softfp/cmse-13.c: Likewise. + * gcc.target/arm/cmse/cmse-5.x: New file. + * gcc.target/arm/cmse/mainline/hard-sp/cmse-5.c: Remove code and + include above file. + * gcc.target/arm/cmse/mainline/hard/cmse-5.c: Likewise. + * gcc.target/arm/cmse/mainline/soft/cmse-5.c: Likewise. + * gcc.target/arm/cmse/mainline/softfp-sp/cmse-5.c: Likewise. + * gcc.target/arm/cmse/mainline/softfp/cmse-5.c: Likewise. + * gcc.target/arm/cmse/cmse-7.x: New file. + * gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c: Remove code and + include above file. + * gcc.target/arm/cmse/mainline/hard/cmse-7.c: Likewise. + * gcc.target/arm/cmse/mainline/soft/cmse-7.c: Likewise. + * gcc.target/arm/cmse/mainline/softfp-sp/cmse-7.c: Likewise. + * gcc.target/arm/cmse/mainline/softfp/cmse-7.c: Likewise. + * gcc.target/arm/cmse/cmse-8.x: New file. + * gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c: Remove code and + include above file. + * gcc.target/arm/cmse/mainline/hard/cmse-8.c: Likewise. + * gcc.target/arm/cmse/mainline/soft/cmse-8.c: Likewise. + * gcc.target/arm/cmse/mainline/softfp-sp/cmse-8.c: Likewise. + * gcc.target/arm/cmse/mainline/softfp/cmse-8.c: Likewise. + * gcc.target/arm/cmse/union-1.x: New file. + * gcc.target/arm/cmse/baseline/union-1.c: Remove code and include above + file. + * gcc.target/arm/cmse/mainline/union-1.c: Likewise. + * gcc.target/arm/cmse/union-2.x: New file. + * gcc.target/arm/cmse/baseline/union-2.c: Remove code and include above + file. + * gcc.target/arm/cmse/mainline/union-2.c: Likewise. + 2017-11-10 Martin Sebor PR c/81117 diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-4.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-4.c index a6c1386..2911da3 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-4.c +++ b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-4.c @@ -1,46 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a; - unsigned int b:5; - unsigned int c:11, :0, d:8; - struct { unsigned int ee:2; } e; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -extern void foo (test_st st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - r.values.v3 = 0xFFFFFFFF; - r.values.v4 = 0xFFFFFFFF; - - f (r.st); - return 0; -} +#include "../bitfield-4.x" /* { dg-final { scan-assembler "mov\tip, r4" } } */ /* { dg-final { scan-assembler "movw\tr4, #65535" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-5.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-5.c index d51ce2d..376e92b 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-5.c +++ b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-5.c @@ -1,42 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a; - unsigned short b :5; - unsigned char c; - unsigned short d :11; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - - f (r.st); - return 0; -} +#include "../bitfield-5.x" /* { dg-final { scan-assembler "mov\tip, r4" } } */ /* { dg-final { scan-assembler "movw\tr4, #8191" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-6.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-6.c index 77e9104..9845b60 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-6.c +++ b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-6.c @@ -1,51 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a; - unsigned int b : 3; - unsigned int c : 14; - unsigned int d : 1; - struct { - unsigned int ee : 2; - unsigned short ff : 15; - } e; - unsigned char g : 1; - unsigned char : 4; - unsigned char h : 3; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - r.values.v3 = 0xFFFFFFFF; - r.values.v4 = 0xFFFFFFFF; - - f (r.st); - return 0; -} +#include "../bitfield-6.x" /* { dg-final { scan-assembler "mov\tip, r4" } } */ /* { dg-final { scan-assembler "movw\tr4, #65535" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-7.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-7.c index 3d8941b..2ea52df 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-7.c +++ b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-7.c @@ -1,43 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a; - unsigned short b :5; - unsigned char c; - unsigned short d :11; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - - f (r.st); - return 0; -} - +#include "../bitfield-7.x" /* { dg-final { scan-assembler "mov\tip, r4" } } */ /* { dg-final { scan-assembler "movw\tr4, #8191" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-8.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-8.c index 9ffbb71..9bc32b8 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-8.c +++ b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-8.c @@ -1,45 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a; - unsigned int :0; - unsigned int b :1; - unsigned short :0; - unsigned short c; - unsigned int :0; - unsigned int d :21; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - r.values.v3 = 0xFFFFFFFF; - - f (r.st); - return 0; -} +#include "../bitfield-8.x" /* { dg-final { scan-assembler "mov\tip, r4" } } */ /* { dg-final { scan-assembler "movs\tr4, #255" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-9.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-9.c index 8a61418..f6c1533 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-9.c +++ b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-9.c @@ -1,48 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - char a:3; -} test_st3; - -typedef struct -{ - char a:3; -} test_st2; - -typedef struct -{ - test_st2 st2; - test_st3 st3; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - - f (r.st); - return 0; -} +#include "../bitfield-9.x" /* { dg-final { scan-assembler "mov\tip, r4" } } */ /* { dg-final { scan-assembler "movw\tr4, #1799" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-and-union-1.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-and-union-1.c deleted file mode 100644 index 642f4e0..0000000 --- a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-and-union-1.c +++ /dev/null @@ -1,96 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-mcmse" } */ - -typedef struct -{ - unsigned short a :11; -} test_st_4; - -typedef union -{ - char a; - test_st_4 st4; -}test_un_2; - -typedef struct -{ - unsigned char a; - unsigned int :0; - unsigned int b :1; - unsigned short :0; - unsigned short c; - unsigned int :0; - unsigned int d :21; -} test_st_3; - -typedef struct -{ - unsigned char a :3; - unsigned int b :13; - test_un_2 un2; -} test_st_2; - -typedef union -{ - test_st_2 st2; - test_st_3 st3; -}test_un_1; - -typedef struct -{ - unsigned char a :2; - unsigned char :0; - unsigned short b :5; - unsigned char :0; - unsigned char c :4; - test_un_1 un1; -} test_st_1; - -typedef union -{ - test_st_1 st1; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st_1; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st_1); - -int -main (void) -{ - read_st_1 r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - r.values.v3 = 0xFFFFFFFF; - r.values.v4 = 0xFFFFFFFF; - - f (r.st1); - return 0; -} - -/* { dg-final { scan-assembler "mov\tip, r4" } } */ -/* { dg-final { scan-assembler "movw\tr4, #7939" } } */ -/* { dg-final { scan-assembler "movt\tr4, 15" } } */ -/* { dg-final { scan-assembler "ands\tr0, r4" } } */ -/* { dg-final { scan-assembler "movw\tr4, #65535" } } */ -/* { dg-final { scan-assembler "movt\tr4, 2047" } } */ -/* { dg-final { scan-assembler "ands\tr1, r4" } } */ -/* { dg-final { scan-assembler "movs\tr4, #1" } } */ -/* { dg-final { scan-assembler "movt\tr4, 65535" } } */ -/* { dg-final { scan-assembler "ands\tr2, r4" } } */ -/* { dg-final { scan-assembler "movw\tr4, #65535" } } */ -/* { dg-final { scan-assembler "movt\tr4, 31" } } */ -/* { dg-final { scan-assembler "ands\tr3, r4" } } */ -/* { dg-final { scan-assembler "mov\tr4, ip" } } */ -/* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ -/* { dg-final { scan-assembler "lsls\tr4, r4, #1" } } */ -/* { dg-final { scan-assembler "bl\t__gnu_cmse_nonsecure_call" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-and-union.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-and-union.c new file mode 100644 index 0000000..3124948 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/baseline/bitfield-and-union.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-mcmse" } */ + +#include "../bitfield-and-union.x" + +/* { dg-final { scan-assembler "mov\tip, r4" } } */ +/* { dg-final { scan-assembler "movw\tr4, #7939" } } */ +/* { dg-final { scan-assembler "movt\tr4, 15" } } */ +/* { dg-final { scan-assembler "ands\tr0, r4" } } */ +/* { dg-final { scan-assembler "movw\tr4, #65535" } } */ +/* { dg-final { scan-assembler "movt\tr4, 2047" } } */ +/* { dg-final { scan-assembler "ands\tr1, r4" } } */ +/* { dg-final { scan-assembler "movs\tr4, #1" } } */ +/* { dg-final { scan-assembler "movt\tr4, 65535" } } */ +/* { dg-final { scan-assembler "ands\tr2, r4" } } */ +/* { dg-final { scan-assembler "movw\tr4, #65535" } } */ +/* { dg-final { scan-assembler "movt\tr4, 31" } } */ +/* { dg-final { scan-assembler "ands\tr3, r4" } } */ +/* { dg-final { scan-assembler "mov\tr4, ip" } } */ +/* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ +/* { dg-final { scan-assembler "lsls\tr4, r4, #1" } } */ +/* { dg-final { scan-assembler "bl\t__gnu_cmse_nonsecure_call" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/cmse-13.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/cmse-13.c index 8ced14b..7208a2c 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/baseline/cmse-13.c +++ b/gcc/testsuite/gcc.target/arm/cmse/baseline/cmse-13.c @@ -3,13 +3,7 @@ /* { dg-require-effective-target arm_arch_v8m_base_ok } */ /* { dg-add-options arm_arch_v8m_base } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (float, double); - -int -foo (int a) -{ - return bar (1.0f, 2.0) + a + 1; -} +#include "../cmse-13.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/union-1.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/union-1.c index ff18e83..afd5b98 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/baseline/union-1.c +++ b/gcc/testsuite/gcc.target/arm/cmse/baseline/union-1.c @@ -1,60 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a :2; - unsigned char :0; - unsigned short b :5; - unsigned char :0; - unsigned short c :3; - unsigned char :0; - unsigned int d :9; -} test_st_1; - -typedef struct -{ - unsigned short a :7; - unsigned char :0; - unsigned char b :1; - unsigned char :0; - unsigned short c :6; -} test_st_2; - -typedef union -{ - test_st_1 st_1; - test_st_2 st_2; -}test_un; - -typedef union -{ - test_un un; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_un; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_un); - -int -main (void) -{ - read_un r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - - f (r.un); - return 0; -} +#include "../union-1.x" /* { dg-final { scan-assembler "mov\tip, r4" } } */ /* { dg-final { scan-assembler "movw\tr4, #8063" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/baseline/union-2.c b/gcc/testsuite/gcc.target/arm/cmse/baseline/union-2.c index b2e024b..6e60f2a 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/baseline/union-2.c +++ b/gcc/testsuite/gcc.target/arm/cmse/baseline/union-2.c @@ -1,73 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a :2; - unsigned char :0; - unsigned short b :5; - unsigned char :0; - unsigned short c :3; - unsigned char :0; - unsigned int d :9; -} test_st_1; - -typedef struct -{ - unsigned short a :7; - unsigned char :0; - unsigned char b :1; - unsigned char :0; - unsigned short c :6; -} test_st_2; - -typedef struct -{ - unsigned char a; - unsigned int :0; - unsigned int b :1; - unsigned short :0; - unsigned short c; - unsigned int :0; - unsigned int d :21; -} test_st_3; - -typedef union -{ - test_st_1 st_1; - test_st_2 st_2; - test_st_3 st_3; -}test_un; - -typedef union -{ - test_un un; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_un; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_un); - -int -main (void) -{ - read_un r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - r.values.v3 = 0xFFFFFFFF; - - f (r.un); - return 0; -} +#include "../union-2.x" /* { dg-final { scan-assembler "mov\tip, r4" } } */ /* { dg-final { scan-assembler "movw\tr4, #8191" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-4.x b/gcc/testsuite/gcc.target/arm/cmse/bitfield-4.x new file mode 100644 index 0000000..62e35cc --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-4.x @@ -0,0 +1,40 @@ +typedef struct +{ + unsigned char a; + unsigned int b:5; + unsigned int c:11, :0, d:8; + struct { unsigned int ee:2; } e; +} test_st; + +typedef union +{ + test_st st; + struct + { + unsigned int v1; + unsigned int v2; + unsigned int v3; + unsigned int v4; + }values; +} read_st; + + +typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); + +extern void foo (test_st st); + +int +main (void) +{ + read_st r; + foo_ns f; + + f = (foo_ns) 0x200000; + r.values.v1 = 0xFFFFFFFF; + r.values.v2 = 0xFFFFFFFF; + r.values.v3 = 0xFFFFFFFF; + r.values.v4 = 0xFFFFFFFF; + + f (r.st); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-5.x b/gcc/testsuite/gcc.target/arm/cmse/bitfield-5.x new file mode 100644 index 0000000..de5649d --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-5.x @@ -0,0 +1,36 @@ +typedef struct +{ + unsigned char a; + unsigned short b :5; + unsigned char c; + unsigned short d :11; +} test_st; + +typedef union +{ + test_st st; + struct + { + unsigned int v1; + unsigned int v2; + unsigned int v3; + unsigned int v4; + }values; +} read_st; + + +typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); + +int +main (void) +{ + read_st r; + foo_ns f; + + f = (foo_ns) 0x200000; + r.values.v1 = 0xFFFFFFFF; + r.values.v2 = 0xFFFFFFFF; + + f (r.st); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-6.x b/gcc/testsuite/gcc.target/arm/cmse/bitfield-6.x new file mode 100644 index 0000000..693a8ae --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-6.x @@ -0,0 +1,45 @@ +typedef struct +{ + unsigned char a; + unsigned int b : 3; + unsigned int c : 14; + unsigned int d : 1; + struct { + unsigned int ee : 2; + unsigned short ff : 15; + } e; + unsigned char g : 1; + unsigned char : 4; + unsigned char h : 3; +} test_st; + +typedef union +{ + test_st st; + struct + { + unsigned int v1; + unsigned int v2; + unsigned int v3; + unsigned int v4; + }values; +} read_st; + + +typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); + +int +main (void) +{ + read_st r; + foo_ns f; + + f = (foo_ns) 0x200000; + r.values.v1 = 0xFFFFFFFF; + r.values.v2 = 0xFFFFFFFF; + r.values.v3 = 0xFFFFFFFF; + r.values.v4 = 0xFFFFFFFF; + + f (r.st); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-7.x b/gcc/testsuite/gcc.target/arm/cmse/bitfield-7.x new file mode 100644 index 0000000..de5649d --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-7.x @@ -0,0 +1,36 @@ +typedef struct +{ + unsigned char a; + unsigned short b :5; + unsigned char c; + unsigned short d :11; +} test_st; + +typedef union +{ + test_st st; + struct + { + unsigned int v1; + unsigned int v2; + unsigned int v3; + unsigned int v4; + }values; +} read_st; + + +typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); + +int +main (void) +{ + read_st r; + foo_ns f; + + f = (foo_ns) 0x200000; + r.values.v1 = 0xFFFFFFFF; + r.values.v2 = 0xFFFFFFFF; + + f (r.st); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-8.x b/gcc/testsuite/gcc.target/arm/cmse/bitfield-8.x new file mode 100644 index 0000000..654b21e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-8.x @@ -0,0 +1,39 @@ +typedef struct +{ + unsigned char a; + unsigned int :0; + unsigned int b :1; + unsigned short :0; + unsigned short c; + unsigned int :0; + unsigned int d :21; +} test_st; + +typedef union +{ + test_st st; + struct + { + unsigned int v1; + unsigned int v2; + unsigned int v3; + unsigned int v4; + }values; +} read_st; + +typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); + +int +main (void) +{ + read_st r; + foo_ns f; + + f = (foo_ns) 0x200000; + r.values.v1 = 0xFFFFFFFF; + r.values.v2 = 0xFFFFFFFF; + r.values.v3 = 0xFFFFFFFF; + + f (r.st); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-9.x b/gcc/testsuite/gcc.target/arm/cmse/bitfield-9.x new file mode 100644 index 0000000..7543ac5 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-9.x @@ -0,0 +1,42 @@ +typedef struct +{ + char a:3; +} test_st3; + +typedef struct +{ + char a:3; +} test_st2; + +typedef struct +{ + test_st2 st2; + test_st3 st3; +} test_st; + +typedef union +{ + test_st st; + struct + { + unsigned int v1; + unsigned int v2; + unsigned int v3; + unsigned int v4; + }values; +} read_st; + +typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); + +int +main (void) +{ + read_st r; + foo_ns f; + + f = (foo_ns) 0x200000; + r.values.v1 = 0xFFFFFFFF; + + f (r.st); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-and-union-1.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-and-union.x similarity index 54% rename from gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-and-union-1.c rename to gcc/testsuite/gcc.target/arm/cmse/bitfield-and-union.x index e139ba6..0a6eb3dd8 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-and-union-1.c +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-and-union.x @@ -1,6 +1,3 @@ -/* { dg-do compile } */ -/* { dg-options "-mcmse" } */ - typedef struct { unsigned short a :11; @@ -76,19 +73,3 @@ main (void) f (r.st1); return 0; } - -/* { dg-final { scan-assembler "movw\tip, #7939" } } */ -/* { dg-final { scan-assembler "movt\tip, 15" } } */ -/* { dg-final { scan-assembler "and\tr0, r0, ip" } } */ -/* { dg-final { scan-assembler "movw\tip, #65535" } } */ -/* { dg-final { scan-assembler "movt\tip, 2047" } } */ -/* { dg-final { scan-assembler "and\tr1, r1, ip" } } */ -/* { dg-final { scan-assembler "mov\tip, #1" } } */ -/* { dg-final { scan-assembler "movt\tip, 65535" } } */ -/* { dg-final { scan-assembler "and\tr2, r2, ip" } } */ -/* { dg-final { scan-assembler "movw\tip, #65535" } } */ -/* { dg-final { scan-assembler "movt\tip, 31" } } */ -/* { dg-final { scan-assembler "and\tr3, r3, ip" } } */ -/* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ -/* { dg-final { scan-assembler "lsls\tr4, r4, #1" } } */ -/* { dg-final { scan-assembler "bl\t__gnu_cmse_nonsecure_call" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-13.x b/gcc/testsuite/gcc.target/arm/cmse/cmse-13.x new file mode 100644 index 0000000..cdcd5ba --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-13.x @@ -0,0 +1,7 @@ +int __attribute__ ((cmse_nonsecure_call)) (*bar) (float, double); + +int +foo (int a) +{ + return bar (3.0f, 2.0) + a + 1; +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-5.x b/gcc/testsuite/gcc.target/arm/cmse/cmse-5.x new file mode 100644 index 0000000..7b03819 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-5.x @@ -0,0 +1,7 @@ +extern float bar (void); + +float __attribute__ ((cmse_nonsecure_entry)) +foo (void) +{ + return bar (); +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-7.x b/gcc/testsuite/gcc.target/arm/cmse/cmse-7.x new file mode 100644 index 0000000..3fa372a --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-7.x @@ -0,0 +1,7 @@ +int __attribute__ ((cmse_nonsecure_call)) (*bar) (void); + +int +foo (int a) +{ + return bar () + a + 1; +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-8.x b/gcc/testsuite/gcc.target/arm/cmse/cmse-8.x new file mode 100644 index 0000000..7e14795 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-8.x @@ -0,0 +1,7 @@ +int __attribute__ ((cmse_nonsecure_call)) (*bar) (double); + +int +foo (int a) +{ + return bar (2.0) + a + 1; +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-4.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-4.c index c3b1396..55da2a0 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-4.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-4.c @@ -1,46 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a; - unsigned int b:5; - unsigned int c:11, :0, d:8; - struct { unsigned int ee:2; } e; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -extern void foo (test_st st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - r.values.v3 = 0xFFFFFFFF; - r.values.v4 = 0xFFFFFFFF; - - f (r.st); - return 0; -} +#include "../bitfield-4.x" /* { dg-final { scan-assembler "movw\tip, #65535" } } */ /* { dg-final { scan-assembler "movt\tip, 255" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-5.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-5.c index 0d02904..3833632 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-5.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-5.c @@ -1,42 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a; - unsigned short b :5; - unsigned char c; - unsigned short d :11; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - - f (r.st); - return 0; -} +#include "../bitfield-5.x" /* { dg-final { scan-assembler "movw\tip, #8191" } } */ /* { dg-final { scan-assembler "movt\tip, 255" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-6.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-6.c index 005515a..03c294e 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-6.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-6.c @@ -1,51 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a; - unsigned int b : 3; - unsigned int c : 14; - unsigned int d : 1; - struct { - unsigned int ee : 2; - unsigned short ff : 15; - } e; - unsigned char g : 1; - unsigned char : 4; - unsigned char h : 3; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - r.values.v3 = 0xFFFFFFFF; - r.values.v4 = 0xFFFFFFFF; - - f (r.st); - return 0; -} +#include "../bitfield-6.x" /* { dg-final { scan-assembler "movw\tip, #65535" } } */ /* { dg-final { scan-assembler "movt\tip, 1023" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-7.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-7.c index 6dd218e..7692a69 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-7.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-7.c @@ -1,43 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a; - unsigned short b :5; - unsigned char c; - unsigned short d :11; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - - f (r.st); - return 0; -} - +#include "../bitfield-7.x" /* { dg-final { scan-assembler "movw\tip, #8191" } } */ /* { dg-final { scan-assembler "movt\tip, 255" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-8.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-8.c index c833bcb..a0a4887 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-8.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-8.c @@ -1,45 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a; - unsigned int :0; - unsigned int b :1; - unsigned short :0; - unsigned short c; - unsigned int :0; - unsigned int d :21; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - r.values.v3 = 0xFFFFFFFF; - - f (r.st); - return 0; -} +#include "../bitfield-8.x" /* { dg-final { scan-assembler "mov\tip, #255" } } */ /* { dg-final { scan-assembler "and\tr0, r0, ip" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-9.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-9.c index d6e4cdb..8bfeeb0 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-9.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-9.c @@ -1,48 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - char a:3; -} test_st3; - -typedef struct -{ - char a:3; -} test_st2; - -typedef struct -{ - test_st2 st2; - test_st3 st3; -} test_st; - -typedef union -{ - test_st st; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_st; - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_st); - -int -main (void) -{ - read_st r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - - f (r.st); - return 0; -} +#include "../bitfield-9.x" /* { dg-final { scan-assembler "movw\tip, #1799" } } */ /* { dg-final { scan-assembler "and\tr0, r0, ip" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-and-union.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-and-union.c new file mode 100644 index 0000000..aac5ae1 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/bitfield-and-union.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-mcmse" } */ + +#include "../bitfield-and-union.x" + +/* { dg-final { scan-assembler "movw\tip, #7939" } } */ +/* { dg-final { scan-assembler "movt\tip, 15" } } */ +/* { dg-final { scan-assembler "and\tr0, r0, ip" } } */ +/* { dg-final { scan-assembler "movw\tip, #65535" } } */ +/* { dg-final { scan-assembler "movt\tip, 2047" } } */ +/* { dg-final { scan-assembler "and\tr1, r1, ip" } } */ +/* { dg-final { scan-assembler "mov\tip, #1" } } */ +/* { dg-final { scan-assembler "movt\tip, 65535" } } */ +/* { dg-final { scan-assembler "and\tr2, r2, ip" } } */ +/* { dg-final { scan-assembler "movw\tip, #65535" } } */ +/* { dg-final { scan-assembler "movt\tip, 31" } } */ +/* { dg-final { scan-assembler "and\tr3, r3, ip" } } */ +/* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ +/* { dg-final { scan-assembler "lsls\tr4, r4, #1" } } */ +/* { dg-final { scan-assembler "bl\t__gnu_cmse_nonsecure_call" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c index a484cfe..6f4d6b4 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-13.c @@ -5,14 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=softfp } {""} } */ /* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */ - -int __attribute__ ((cmse_nonsecure_call)) (*bar) (float, double); - -int -foo (int a) -{ - return bar (3.0f, 2.0) + a + 1; -} +#include "../../cmse-13.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-5.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-5.c index ebc080a..0ae2a51 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-5.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-5.c @@ -5,13 +5,8 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=softfp } {""} } */ /* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */ -extern float bar (void); +#include "../../cmse-5.x" -float __attribute__ ((cmse_nonsecure_entry)) -foo (void) -{ - return bar (); -} /* { dg-final { scan-assembler "mov\tr0, lr" } } */ /* { dg-final { scan-assembler "mov\tr1, lr" } } */ /* { dg-final { scan-assembler "mov\tr2, lr" } } */ @@ -32,8 +27,8 @@ foo (void) /* { dg-final { scan-assembler "vmov\.f32\ts13, #1\.0" } } */ /* { dg-final { scan-assembler "vmov\.f32\ts14, #1\.0" } } */ /* { dg-final { scan-assembler "vmov\.f32\ts15, #1\.0" } } */ -/* { dg-final { scan-assembler "msr\tAPSR_nzcvq, lr" { target { arm_arch_v8m_main_ok && { ! arm_dsp } } } } } */ -/* { dg-final { scan-assembler "msr\tAPSR_nzcvqg, lr" { target { arm_arch_v8m_main_ok && arm_dsp } } } } */ +/* { dg-final { scan-assembler "msr\tAPSR_nzcvq, lr" { target { ! arm_dsp } } } } */ +/* { dg-final { scan-assembler "msr\tAPSR_nzcvqg, lr" { target arm_dsp } } } */ /* { dg-final { scan-assembler "push\t{r4}" } } */ /* { dg-final { scan-assembler "vmrs\tip, fpscr" } } */ /* { dg-final { scan-assembler "movw\tr4, #65376" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c index 4fabd45..141ba73 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-7.c @@ -5,13 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=softfp } {""} } */ /* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (void); - -int -foo (int a) -{ - return bar () + a + 1; -} +#include "../../cmse-7.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c index 9b18c3a..6c5e688 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard-sp/cmse-8.c @@ -5,13 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=softfp } {""} } */ /* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (double); - -int -foo (int a) -{ - return bar (2.0) + a + 1; -} +#include "../../cmse-8.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-13.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-13.c index 36e301a..d35321b 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-13.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-13.c @@ -5,14 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=softfp } {""} } */ /* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ - -int __attribute__ ((cmse_nonsecure_call)) (*bar) (float, double); - -int -foo (int a) -{ - return bar (3.0f, 2.0) + a + 1; -} +#include "../../cmse-13.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-5.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-5.c index 5a7fb04..955f749 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-5.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-5.c @@ -5,13 +5,8 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=softfp } {""} } */ /* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ -extern float bar (void); +#include "../../cmse-5.x" -float __attribute__ ((cmse_nonsecure_entry)) -foo (void) -{ - return bar (); -} /* { dg-final { scan-assembler "mov\tr0, lr" } } */ /* { dg-final { scan-assembler "mov\tr1, lr" } } */ /* { dg-final { scan-assembler "mov\tr2, lr" } } */ @@ -25,8 +20,8 @@ foo (void) /* { dg-final { scan-assembler "vmov\.f64\td5, #1\.0" } } */ /* { dg-final { scan-assembler "vmov\.f64\td6, #1\.0" } } */ /* { dg-final { scan-assembler "vmov\.f64\td7, #1\.0" } } */ -/* { dg-final { scan-assembler "msr\tAPSR_nzcvq, lr" { target { arm_arch_v8m_main_ok && { ! arm_dsp } } } } } */ -/* { dg-final { scan-assembler "msr\tAPSR_nzcvqg, lr" { target { arm_arch_v8m_main_ok && arm_dsp } } } } */ +/* { dg-final { scan-assembler "msr\tAPSR_nzcvq, lr" { target { ! arm_dsp } } } } */ +/* { dg-final { scan-assembler "msr\tAPSR_nzcvqg, lr" { target arm_dsp } } } */ /* { dg-final { scan-assembler "push\t{r4}" } } */ /* { dg-final { scan-assembler "vmrs\tip, fpscr" } } */ /* { dg-final { scan-assembler "movw\tr4, #65376" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-7.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-7.c index ff77579..858555b 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-7.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-7.c @@ -5,13 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=softfp } {""} } */ /* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (void); - -int -foo (int a) -{ - return bar () + a + 1; -} +#include "../../cmse-7.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-8.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-8.c index dce0d90..f85d68a 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-8.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/hard/cmse-8.c @@ -5,13 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=softfp } {""} } */ /* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (double); - -int -foo (int a) -{ - return bar (2.0) + a + 1; -} +#include "../../cmse-8.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-13.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-13.c index fe2ac47..11d4455 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-13.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-13.c @@ -4,13 +4,7 @@ /* { dg-add-options arm_arch_v8m_main } */ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=hard" -mfloat-abi=softfp } {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (float, double); - -int -foo (int a) -{ - return bar (1.0f, 2.0) + a + 1; -} +#include "../../cmse-13.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-5.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-5.c index dff8baa..dfd2fe6 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-5.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-5.c @@ -4,13 +4,7 @@ /* { dg-add-options arm_arch_v8m_main } */ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=hard" -mfloat-abi=softfp } {""} } */ -extern float bar (void); - -float __attribute__ ((cmse_nonsecure_entry)) -foo (void) -{ - return bar (); -} +#include "../../cmse-5.x" /* { dg-final { scan-assembler "mov\tr1, lr" } } */ /* { dg-final { scan-assembler "mov\tr2, lr" } } */ @@ -18,7 +12,7 @@ foo (void) /* { dg-final { scan-assembler "mov\tip, lr" } } */ /* { dg-final { scan-assembler-not "vmov" } } */ /* { dg-final { scan-assembler-not "vmsr" } } */ -/* { dg-final { scan-assembler "msr\tAPSR_nzcvq, lr" { target { arm_arch_v8m_main_ok && { ! arm_dsp } } } } } */ -/* { dg-final { scan-assembler "msr\tAPSR_nzcvqg, lr" { target { arm_arch_v8m_main_ok && arm_dsp } } } } */ +/* { dg-final { scan-assembler "msr\tAPSR_nzcvq, lr" { target { ! arm_dsp } } } } */ +/* { dg-final { scan-assembler "msr\tAPSR_nzcvqg, lr" { target arm_dsp } } } */ /* { dg-final { scan-assembler "bxns" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-7.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-7.c index a451f7a..76ca271 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-7.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-7.c @@ -4,13 +4,7 @@ /* { dg-add-options arm_arch_v8m_main } */ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=hard" -mfloat-abi=softfp } {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (void); - -int -foo (int a) -{ - return bar () + a + 1; -} +#include "../../cmse-7.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-8.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-8.c index 6502fb7..a917aa7 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-8.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/soft/cmse-8.c @@ -4,13 +4,7 @@ /* { dg-add-options arm_arch_v8m_main } */ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=hard" -mfloat-abi=softfp } {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (double); - -int -foo (int a) -{ - return bar (2.0) + a + 1; -} +#include "../../cmse-8.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-5.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-5.c index c14ef43..01e5d65 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-5.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-5.c @@ -5,13 +5,8 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=hard } {""} } */ /* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */ -extern float bar (void); +#include "../../cmse-5.x" -float __attribute__ ((cmse_nonsecure_entry)) -foo (void) -{ - return bar (); -} /* { dg-final { scan-assembler "__acle_se_foo:" } } */ /* { dg-final { scan-assembler-not "mov\tr0, lr" } } */ /* { dg-final { scan-assembler "mov\tr1, lr" } } */ @@ -33,8 +28,8 @@ foo (void) /* { dg-final { scan-assembler "vmov\.f32\ts13, #1\.0" } } */ /* { dg-final { scan-assembler "vmov\.f32\ts14, #1\.0" } } */ /* { dg-final { scan-assembler "vmov\.f32\ts15, #1\.0" } } */ -/* { dg-final { scan-assembler "msr\tAPSR_nzcvq, lr" { target { arm_arch_v8m_main_ok && { ! arm_dsp } } } } } */ -/* { dg-final { scan-assembler "msr\tAPSR_nzcvqg, lr" { target { arm_arch_v8m_main_ok && arm_dsp } } } } */ +/* { dg-final { scan-assembler "msr\tAPSR_nzcvq, lr" { target { ! arm_dsp } } } } */ +/* { dg-final { scan-assembler "msr\tAPSR_nzcvqg, lr" { target arm_dsp } } } */ /* { dg-final { scan-assembler "push\t{r4}" } } */ /* { dg-final { scan-assembler "vmrs\tip, fpscr" } } */ /* { dg-final { scan-assembler "movw\tr4, #65376" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-7.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-7.c index db17035..5d90478 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-7.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-7.c @@ -5,13 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=hard } {""} } */ /* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (void); - -int -foo (int a) -{ - return bar () + a + 1; -} +#include "../../cmse-7.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-8.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-8.c index 27acb9e..3feee43 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-8.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp-sp/cmse-8.c @@ -5,13 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=hard } {""} } */ /* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (double); - -int -foo (int a) -{ - return bar (2.0) + a + 1; -} +#include "../../cmse-8.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-13.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-13.c index 97aba0d..4eb984f 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-13.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-13.c @@ -5,13 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=hard } {""} } */ /* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (float, double); - -int -foo (int a) -{ - return bar (1.0f, 2.0) + a + 1; -} +#include "../../cmse-13.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-5.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-5.c index 5db8880..4815a48 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-5.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-5.c @@ -5,13 +5,8 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=hard } {""} } */ /* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ -extern float bar (void); +#include "../../cmse-5.x" -float __attribute__ ((cmse_nonsecure_entry)) -foo (void) -{ - return bar (); -} /* { dg-final { scan-assembler "__acle_se_foo:" } } */ /* { dg-final { scan-assembler-not "mov\tr0, lr" } } */ /* { dg-final { scan-assembler "mov\tr1, lr" } } */ @@ -25,8 +20,8 @@ foo (void) /* { dg-final { scan-assembler "vmov\.f64\td5, #1\.0" } } */ /* { dg-final { scan-assembler "vmov\.f64\td6, #1\.0" } } */ /* { dg-final { scan-assembler "vmov\.f64\td7, #1\.0" } } */ -/* { dg-final { scan-assembler "msr\tAPSR_nzcvq, lr" { target { arm_arch_v8m_main_ok && { ! arm_dsp } } } } } */ -/* { dg-final { scan-assembler "msr\tAPSR_nzcvqg, lr" { target { arm_arch_v8m_main_ok && arm_dsp } } } } */ +/* { dg-final { scan-assembler "msr\tAPSR_nzcvq, lr" { target { ! arm_dsp } } } } */ +/* { dg-final { scan-assembler "msr\tAPSR_nzcvqg, lr" { target arm_dsp } } } */ /* { dg-final { scan-assembler "push\t{r4}" } } */ /* { dg-final { scan-assembler "vmrs\tip, fpscr" } } */ /* { dg-final { scan-assembler "movw\tr4, #65376" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-7.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-7.c index c4d678d..5535c551 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-7.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-7.c @@ -5,13 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=hard } {""} } */ /* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (void); - -int -foo (int a) -{ - return bar () + a + 1; -} +#include "../../cmse-7.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-8.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-8.c index 948476d..6663fc4 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-8.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/softfp/cmse-8.c @@ -5,13 +5,7 @@ /* { dg-skip-if "Do not combine float-abi= hard | soft | softfp" {*-*-*} {"-mfloat-abi=soft" -mfloat-abi=hard } {""} } */ /* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */ -int __attribute__ ((cmse_nonsecure_call)) (*bar) (double); - -int -foo (int a) -{ - return bar (2.0) + a + 1; -} +#include "../../cmse-8.x" /* Checks for saving and clearing prior to function call. */ /* { dg-final { scan-assembler "lsrs\tr4, r4, #1" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/union-1.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/union-1.c index 1fc846c..071955f 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/union-1.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/union-1.c @@ -1,60 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a :2; - unsigned char :0; - unsigned short b :5; - unsigned char :0; - unsigned short c :3; - unsigned char :0; - unsigned int d :9; -} test_st_1; - -typedef struct -{ - unsigned short a :7; - unsigned char :0; - unsigned char b :1; - unsigned char :0; - unsigned short c :6; -} test_st_2; - -typedef union -{ - test_st_1 st_1; - test_st_2 st_2; -}test_un; - -typedef union -{ - test_un un; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_un; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_un); - -int -main (void) -{ - read_un r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - - f (r.un); - return 0; -} +#include "../union-1.x" /* { dg-final { scan-assembler "movw\tip, #8063" } } */ /* { dg-final { scan-assembler "movt\tip, 63" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/union-2.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/union-2.c index 420d0f1..c743193 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/mainline/union-2.c +++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/union-2.c @@ -1,73 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mcmse" } */ -typedef struct -{ - unsigned char a :2; - unsigned char :0; - unsigned short b :5; - unsigned char :0; - unsigned short c :3; - unsigned char :0; - unsigned int d :9; -} test_st_1; - -typedef struct -{ - unsigned short a :7; - unsigned char :0; - unsigned char b :1; - unsigned char :0; - unsigned short c :6; -} test_st_2; - -typedef struct -{ - unsigned char a; - unsigned int :0; - unsigned int b :1; - unsigned short :0; - unsigned short c; - unsigned int :0; - unsigned int d :21; -} test_st_3; - -typedef union -{ - test_st_1 st_1; - test_st_2 st_2; - test_st_3 st_3; -}test_un; - -typedef union -{ - test_un un; - struct - { - unsigned int v1; - unsigned int v2; - unsigned int v3; - unsigned int v4; - }values; -} read_un; - - -typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_un); - -int -main (void) -{ - read_un r; - foo_ns f; - - f = (foo_ns) 0x200000; - r.values.v1 = 0xFFFFFFFF; - r.values.v2 = 0xFFFFFFFF; - r.values.v3 = 0xFFFFFFFF; - - f (r.un); - return 0; -} +#include "../union-2.x" /* { dg-final { scan-assembler "movw\tip, #8191" } } */ /* { dg-final { scan-assembler "movt\tip, 63" } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/union-1.x b/gcc/testsuite/gcc.target/arm/cmse/union-1.x new file mode 100644 index 0000000..8fe9535 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/union-1.x @@ -0,0 +1,54 @@ +typedef struct +{ + unsigned char a :2; + unsigned char :0; + unsigned short b :5; + unsigned char :0; + unsigned short c :3; + unsigned char :0; + unsigned int d :9; +} test_st_1; + +typedef struct +{ + unsigned short a :7; + unsigned char :0; + unsigned char b :1; + unsigned char :0; + unsigned short c :6; +} test_st_2; + +typedef union +{ + test_st_1 st_1; + test_st_2 st_2; +}test_un; + +typedef union +{ + test_un un; + struct + { + unsigned int v1; + unsigned int v2; + unsigned int v3; + unsigned int v4; + }values; +} read_un; + + +typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_un); + +int +main (void) +{ + read_un r; + foo_ns f; + + f = (foo_ns) 0x200000; + r.values.v1 = 0xFFFFFFFF; + r.values.v2 = 0xFFFFFFFF; + + f (r.un); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/cmse/union-2.x b/gcc/testsuite/gcc.target/arm/cmse/union-2.x new file mode 100644 index 0000000..8a880e7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/union-2.x @@ -0,0 +1,67 @@ +typedef struct +{ + unsigned char a :2; + unsigned char :0; + unsigned short b :5; + unsigned char :0; + unsigned short c :3; + unsigned char :0; + unsigned int d :9; +} test_st_1; + +typedef struct +{ + unsigned short a :7; + unsigned char :0; + unsigned char b :1; + unsigned char :0; + unsigned short c :6; +} test_st_2; + +typedef struct +{ + unsigned char a; + unsigned int :0; + unsigned int b :1; + unsigned short :0; + unsigned short c; + unsigned int :0; + unsigned int d :21; +} test_st_3; + +typedef union +{ + test_st_1 st_1; + test_st_2 st_2; + test_st_3 st_3; +}test_un; + +typedef union +{ + test_un un; + struct + { + unsigned int v1; + unsigned int v2; + unsigned int v3; + unsigned int v4; + }values; +} read_un; + + +typedef void __attribute__ ((cmse_nonsecure_call)) (*foo_ns) (test_un); + +int +main (void) +{ + read_un r; + foo_ns f; + + f = (foo_ns) 0x200000; + r.values.v1 = 0xFFFFFFFF; + r.values.v2 = 0xFFFFFFFF; + r.values.v3 = 0xFFFFFFFF; + + f (r.un); + return 0; +} -- 2.7.4