This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2] [ARC] Fix tst_bitfield_tst pattern.


Fixes a typo, adds a test.

gcc/
2017-02-28  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.md (*tst_bitfield_tst): Fix pattern.

gcc/testsuite
2017-02-28  Claudiu Zissulescu  <claziss@synopsys.com>

	* gcc.target/arc/bitfield.c: New file.
---
 gcc/config/arc/arc.md                   |  2 +-
 gcc/testsuite/gcc.target/arc/bitfield.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100755 gcc/testsuite/gcc.target/arc/bitfield.c

diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
index 3aaedd2..6c1e167 100644
--- a/gcc/config/arc/arc.md
+++ b/gcc/config/arc/arc.md
@@ -888,7 +888,7 @@
    && (INTVAL (operands[3]) + INTVAL (operands[2]) <= 11
        || (INTVAL (operands[3]) <= 11
 	   && INTVAL (operands[3]) + INTVAL (operands[2]) == 32))"
-  "tst %1,(1<<%2)-1<<%3"
+  "tst %1,((1<<%2)-1)<<%3"
   [(set_attr "type" "compare")
    (set_attr "cond" "set_zn")
    (set_attr "length" "4")])
diff --git a/gcc/testsuite/gcc.target/arc/bitfield.c b/gcc/testsuite/gcc.target/arc/bitfield.c
new file mode 100755
index 0000000..187cd1d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/bitfield.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#include <stdlib.h>
+
+struct ubifs_budget_req {
+  unsigned int fast:7;
+  unsigned int new_ino_d:13;
+};
+
+int printf(const char *format, ...);
+
+void __attribute__ ((noinline))
+fff(struct ubifs_budget_req *req)
+{
+  if (req->new_ino_d & 7)
+    abort ();
+}
+
+int main (void)
+{
+  struct ubifs_budget_req req = {
+    .fast = 8,
+    .new_ino_d = 0,
+  };
+  fff(&req);
+  return 0;
+}
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]