From 438fbf630358e113747c77b5be64fc3c1321d12a Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Mon, 16 Dec 2019 03:43:19 +0000 Subject: [PATCH] Add a couple int128_t bit-field testcases. 2019-12-15 Andrew Pinski * gcc.c-torture/compile/bitfield-1.c: New test. * gcc.c-torture/compile/bitfield-endian-1.c: New test. * gcc.c-torture/compile/bitfield-endian-2.c: New test. From-SVN: r279409 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.c-torture/compile/bitfield-1.c | 13 +++++++++++++ .../gcc.c-torture/compile/bitfield-endian-1.c | 15 +++++++++++++++ .../gcc.c-torture/compile/bitfield-endian-2.c | 15 +++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/bitfield-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/bitfield-endian-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/bitfield-endian-2.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index da0d3abe350..591f152466b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-12-15 Andrew Pinski + + * gcc.c-torture/compile/bitfield-1.c: New test. + * gcc.c-torture/compile/bitfield-endian-1.c: New test. + * gcc.c-torture/compile/bitfield-endian-2.c: New test. + 2019-12-14 Jakub Jelinek PR tree-optimization/92930 diff --git a/gcc/testsuite/gcc.c-torture/compile/bitfield-1.c b/gcc/testsuite/gcc.c-torture/compile/bitfield-1.c new file mode 100644 index 00000000000..0d5a82c09dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/bitfield-1.c @@ -0,0 +1,13 @@ +/* { dg-require-effective-target int128 } */ + +struct f +{ + __uint128_t t:124; + __uint128_t t1:4; +}; + +struct f g(void) +{ + struct f t = {1, 2}; + return t; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/bitfield-endian-1.c b/gcc/testsuite/gcc.c-torture/compile/bitfield-endian-1.c new file mode 100644 index 00000000000..90920c9d066 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/bitfield-endian-1.c @@ -0,0 +1,15 @@ +/* { dg-require-effective-target int128 } */ + +#define ENDIAN __attribute((scalar_storage_order ("big-endian"))) + +typedef struct ENDIAN +{ + __uint128_t t:124; + __uint128_t t1:4; +}f; + +f g(void) +{ + f t = {1, 2}; + return t; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/bitfield-endian-2.c b/gcc/testsuite/gcc.c-torture/compile/bitfield-endian-2.c new file mode 100644 index 00000000000..7644f71e846 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/bitfield-endian-2.c @@ -0,0 +1,15 @@ +/* { dg-require-effective-target int128 } */ + +#define ENDIAN __attribute((scalar_storage_order ("little-endian"))) + +typedef struct ENDIAN +{ + __uint128_t t:124; + __uint128_t t1:4; +}f; + +f g(void) +{ + f t = {1, 2}; + return t; +} -- 2.30.2