From: Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>
To: <gcc-patches@gcc.gnu.org>
Cc: <Claudiu.Zissulescu@synopsys.com>, <gnu@amylaar.uk>,
<Francois.Bedard@synopsys.com>, <jeremy.bennett@embecosm.com>
Subject: [PATCH 5/6] [ARC] Fix unwanted match for sign extend 16-bit constant.
Date: Mon, 18 Apr 2016 14:35:00 -0000 [thread overview]
Message-ID: <1460990028-5718-6-git-send-email-claziss@synopsys.com> (raw)
In-Reply-To: <1460990028-5718-1-git-send-email-claziss@synopsys.com>
The combine pass may conclude umulhisi3_imm pattern can accept also sign
extended 16-bit constants. This patch prohibits the combine in considering
this pattern as suitable.
OK to apply?
Claudiu
gcc/
2016-04-18 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.md (umulhisi3_imm): Avoid unwanted match for sign
extend 16-bit constants.
* testsuite/gcc.target/arc/umulsihi3_z.c: New file.
---
gcc/config/arc/arc.md | 3 ++-
gcc/testsuite/gcc.target/arc/umulsihi3_z.c | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.target/arc/umulsihi3_z.c
diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
index 74530b1..6731072 100644
--- a/gcc/config/arc/arc.md
+++ b/gcc/config/arc/arc.md
@@ -1729,7 +1729,8 @@
(define_insn "umulhisi3_imm"
[(set (match_operand:SI 0 "register_operand" "=r, r,r, r, r")
(mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" " 0, r,0, 0, r"))
- (match_operand:HI 2 "short_const_int_operand" " L, L,I,C16,C16")))]
+ (match_operand:HI 2 "short_const_int_operand" " L, L,I,C16,C16")))
+ (use (match_dup 2))]
"TARGET_MPYW"
"mpyuw%? %0,%1,%2"
[(set_attr "length" "4,4,4,8,8")
diff --git a/gcc/testsuite/gcc.target/arc/umulsihi3_z.c b/gcc/testsuite/gcc.target/arc/umulsihi3_z.c
new file mode 100644
index 0000000..cf1c00d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/umulsihi3_z.c
@@ -0,0 +1,23 @@
+/* Check if the optimizers are not removing the umulsihi3_imm
+ instruction. */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+
+#include <stdint.h>
+
+static int32_t test (int16_t reg_val)
+{
+ int32_t x = (reg_val & 0xf) * 62500;
+ return x;
+}
+
+int main (void)
+{
+ volatile int32_t x = 0xc172;
+ x = test (x);
+
+ if (x != 0x0001e848)
+ __builtin_abort ();
+ return 0;
+}
+
--
1.9.1
next prev parent reply other threads:[~2016-04-18 14:35 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 14:35 [PATCH 0/6] [ARC] Various fixes Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 1/6] [ARC] Don't use drsub* instructions when selecting fpuda Claudiu Zissulescu
2016-04-28 10:05 ` Joern Wolfgang Rennecke
2016-04-28 12:16 ` Claudiu Zissulescu
2016-04-18 14:35 ` Claudiu Zissulescu [this message]
2016-04-28 11:47 ` [PATCH 5/6] [ARC] Fix unwanted match for sign extend 16-bit constant Joern Wolfgang Rennecke
2016-04-28 17:12 ` [PATCH] " Claudiu Zissulescu
2016-04-28 17:46 ` Joern Wolfgang Rennecke
2016-04-28 20:31 ` Claudiu Zissulescu
2016-04-28 20:57 ` Joern Wolfgang Rennecke
2016-04-29 8:41 ` Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 2/6] [ARC] Fix FPX/FPUDA code gen when compiling for big-endian Claudiu Zissulescu
2016-04-28 10:29 ` Joern Wolfgang Rennecke
2016-04-28 12:54 ` Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 3/6] [ARC] Pass mfpuda to assembler Claudiu Zissulescu
2016-04-28 10:30 ` Joern Wolfgang Rennecke
2016-04-28 13:10 ` Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 4/6] [ARC] Handle FPX NaN within optimized floating point library Claudiu Zissulescu
2016-04-28 11:27 ` Joern Wolfgang Rennecke
2016-04-28 11:35 ` Claudiu Zissulescu
2016-04-28 11:41 ` Joern Wolfgang Rennecke
2016-04-28 11:43 ` Claudiu Zissulescu
2016-04-28 14:12 ` Claudiu Zissulescu
2016-04-28 15:03 ` Joern Wolfgang Rennecke
2016-04-29 10:18 ` [PATCH] " Claudiu Zissulescu
2016-04-29 10:23 ` Joern Wolfgang Rennecke
2016-04-29 10:27 ` Joern Wolfgang Rennecke
2016-04-29 10:31 ` Claudiu Zissulescu
2016-04-29 10:37 ` Joern Wolfgang Rennecke
2016-04-29 10:47 ` Claudiu Zissulescu
2016-04-18 14:35 ` [PATCH 6/6] [ARC] Various instruction pattern fixes Claudiu Zissulescu
2016-04-18 18:26 ` Claudiu Zissulescu
2016-04-28 12:31 ` Joern Wolfgang Rennecke
2016-05-02 11:21 ` Claudiu Zissulescu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460990028-5718-6-git-send-email-claziss@synopsys.com \
--to=claudiu.zissulescu@synopsys.com \
--cc=Francois.Bedard@synopsys.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gnu@amylaar.uk \
--cc=jeremy.bennett@embecosm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).