This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch v2] Try to peephole2 QI *4 into SI on i386
- From: lin zuojian <manjian2006 at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 3 Mar 2014 22:30:28 +0800
- Subject: [Patch v2] Try to peephole2 QI *4 into SI on i386
- Authentication-results: sourceware.org; auth=none
- References: <20140303130203 dot GF10357 at ubuntu>
Hi,
Patch v1 is just wrong.
--
Regards
lin zuojian
---
gcc/config/i386/i386.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index b9f1320..e44fb14 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -18535,6 +18535,56 @@
[(set_attr "type" "other")
(set_attr "length" "3")])
+(define_peephole2
+ [(set (mem:QI (match_operand 0 "register_operand"))
+ (match_operand 1 "const_int_operand"))
+ (set (mem:QI (plus (match_dup 0)
+ (const_int 1)))
+ (match_operand 2 "const_int_operand"))
+ (set (mem:QI (plus (match_dup 0)
+ (const_int 2)))
+ (match_operand 3 "const_int_operand"))
+ (set (mem:QI (plus (match_dup 0)
+ (const_int 3)))
+ (match_operand 4 "const_int_operand"))]
+ ""
+ [(set (mem:SI (match_dup 0))
+ (match_operand 5 "const_int_operand"))]
+{
+ int32_t _const = (INTVAL(operands[1]) & 0xff) | (((INTVAL(operands[2])) & 0xff) << 8)
+ | (((INTVAL(operands[3])) & 0xff) << 16) | (((INTVAL(operands[4])) & 0xff) << 24);
+ operands[5] = gen_rtx_CONST_INT (SImode, _const);
+}
+)
+
+(define_peephole2
+ [(set (mem:QI (plus (match_operand 0 "register_operand")
+ (match_operand 6 "const_int_operand")))
+ (match_operand 1 "const_int_operand"))
+ (set (mem:QI (plus (match_dup 0)
+ (match_operand 7 "const_int_operand")))
+ (match_operand 2 "const_int_operand"))
+ (set (mem:QI (plus (match_dup 0)
+ (match_operand 8 "const_int_operand")))
+ (match_operand 3 "const_int_operand"))
+ (set (mem:QI (plus (match_dup 0)
+ (match_operand 9 "const_int_operand")))
+ (match_operand 4 "const_int_operand"))]
+ ""
+ [(set (mem:SI (plus (match_dup 0)
+ (match_dup 6)))
+ (match_operand 5 "const_int_operand"))]
+{
+ if ((INTVAL(operands[7]) - INTVAL(operands[6]) != 1)
+ && (INTVAL(operands[8]) - INTVAL(operands[7]) != 1)
+ && (INTVAL(operands[9]) - INTVAL(operands[8]) != 1))
+ FAIL;
+ int32_t _const = (INTVAL(operands[1]) & 0xff) | (((INTVAL(operands[2])) & 0xff) << 8)
+ | (((INTVAL(operands[3])) & 0xff) << 16) | (((INTVAL(operands[4])) & 0xff) << 24);
+ operands[5] = gen_rtx_CONST_INT (SImode, _const);
+}
+)
+
(include "mmx.md")
(include "sse.md")
(include "sync.md")
--
1.8.3.2