diff mbox series

[Committed] Add some __int128 bitfield testcases

Message ID CA+=Sn1=kLth-7KH7TR=tT+sJ=8-qfm0Acm4kMVkS9QF71bJh9g@mail.gmail.com
State New
Headers show
Series [Committed] Add some __int128 bitfield testcases | expand

Commit Message

Andrew Pinski Dec. 16, 2019, 3:42 a.m. UTC
Hi,
  While working on the bit-field lowering patch,  I noticed there was
no testcases that used int128_t as bit-fields.  So I added some.
Including two that uses scalar_storage_order.  These are just compile
testcases.

Committed as obvious after testing on x86_64 to make sure the testcases pass.

Thanks,
Andrew Pinski

testsuite/ChangeLog:
        * 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.
diff mbox series

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 279408)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2019-12-15  Andrew Pinski  <apinski@marvell.com>
+
+	* 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  <jakub@redhat.com>
 
 	PR tree-optimization/92930
Index: gcc.c-torture/compile/bitfield-1.c
===================================================================
--- gcc.c-torture/compile/bitfield-1.c	(nonexistent)
+++ gcc.c-torture/compile/bitfield-1.c	(working copy)
@@ -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;
+}
Index: gcc.c-torture/compile/bitfield-endian-1.c
===================================================================
--- gcc.c-torture/compile/bitfield-endian-1.c	(nonexistent)
+++ gcc.c-torture/compile/bitfield-endian-1.c	(working copy)
@@ -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;
+}
Index: gcc.c-torture/compile/bitfield-endian-2.c
===================================================================
--- gcc.c-torture/compile/bitfield-endian-2.c	(nonexistent)
+++ gcc.c-torture/compile/bitfield-endian-2.c	(working copy)
@@ -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;
+}