From: Georg-Johann Lay <avr@gjlay.de>
To: Denis Chertykov <chertykov@gmail.com>
Cc: gcc-patches@gcc.gnu.org, Anatoly Sokolov <aesok@post.ru>,
"Eric B. Weddington" <eric.weddington@atmel.com>
Subject: Re: [Patch, AVR]: Fix PR33049 (implement extzv)
Date: Tue, 21 Jun 2011 16:47:00 -0000 [thread overview]
Message-ID: <4E00C785.1070206@gjlay.de> (raw)
In-Reply-To: <BANLkTimA_T_Dtxs1CEms-amrHsurue2L3A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
Denis Chertykov schrieb:
> I'm vote for 'C'.
>
> Denis.
So it's C :-)
Johann
PR target/33049
* config/avr/avr.md (extzv): New expander.
(*extzv): New insn.
(*extzv.qihi1, *extzv.qihi2): New insn-and-split.
* config/avr/constraints.md (C04): New constraint.
* doc/md.texi (Machine Constraints): Document it.
[-- Attachment #2: pr33049.diff --]
[-- Type: text/x-patch, Size: 3496 bytes --]
Index: doc/md.texi
===================================================================
--- doc/md.texi (revision 175264)
+++ doc/md.texi (working copy)
@@ -1773,6 +1773,9 @@ Integer constant in the range @minus{}6
@item Q
A memory address based on Y or Z pointer with displacement.
+
+@item C04
+Constant integer 4
@end table
@item Hewlett-Packard PA-RISC---@file{config/pa/pa.h}
Index: config/avr/constraints.md
===================================================================
--- config/avr/constraints.md (revision 175201)
+++ config/avr/constraints.md (working copy)
@@ -107,3 +107,8 @@ (define_memory_constraint "Q"
"A memory address based on Y or Z pointer with displacement."
(and (match_code "mem")
(match_test "extra_constraint_Q (op)")))
+
+(define_constraint "C04"
+ "Constant integer 4."
+ (and (match_code "const_int")
+ (match_test "ival == 4")))
Index: config/avr/avr.md
===================================================================
--- config/avr/avr.md (revision 175264)
+++ config/avr/avr.md (working copy)
@@ -3539,3 +3539,65 @@ (define_insn_and_split "*ior<mode>qi.byt
int byteno = INTVAL(operands[2]) / BITS_PER_UNIT;
operands[4] = simplify_gen_subreg (QImode, operands[0], <MODE>mode, byteno);
})
+
+(define_expand "extzv"
+ [(set (match_operand:QI 0 "register_operand" "")
+ (zero_extract:QI (match_operand:QI 1 "register_operand" "")
+ (match_operand:QI 2 "const1_operand" "")
+ (match_operand:QI 3 "const_0_to_7_operand" "")))]
+ ""
+ "")
+
+(define_insn "*extzv"
+ [(set (match_operand:QI 0 "register_operand" "=*d,*d,*d,*d,r")
+ (zero_extract:QI (match_operand:QI 1 "register_operand" "0,r,0,0,r")
+ (const_int 1)
+ (match_operand:QI 2 "const_0_to_7_operand" "L,L,P,C04,n")))]
+ ""
+ "@
+ andi %0,1
+ mov %0,%1\;andi %0,1
+ lsr %0\;andi %0,1
+ swap %0\;andi %0,1
+ bst %1,%2\;clr %0\;bld %0,0"
+ [(set_attr "length" "1,2,2,2,3")
+ (set_attr "cc" "set_zn,set_zn,set_zn,set_zn,clobber")])
+
+(define_insn_and_split "*extzv.qihi1"
+ [(set (match_operand:HI 0 "register_operand" "=r")
+ (zero_extract:HI (match_operand:QI 1 "register_operand" "r")
+ (const_int 1)
+ (match_operand:QI 2 "const_0_to_7_operand" "n")))]
+ ""
+ "#"
+ ""
+ [(set (match_dup 3)
+ (zero_extract:QI (match_dup 1)
+ (const_int 1)
+ (match_dup 2)))
+ (set (match_dup 4)
+ (const_int 0))]
+ {
+ operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, 0);
+ operands[4] = simplify_gen_subreg (QImode, operands[0], HImode, 1);
+ })
+
+(define_insn_and_split "*extzv.qihi2"
+ [(set (match_operand:HI 0 "register_operand" "=r")
+ (zero_extend:HI
+ (zero_extract:QI (match_operand:QI 1 "register_operand" "r")
+ (const_int 1)
+ (match_operand:QI 2 "const_0_to_7_operand" "n"))))]
+ ""
+ "#"
+ ""
+ [(set (match_dup 3)
+ (zero_extract:QI (match_dup 1)
+ (const_int 1)
+ (match_dup 2)))
+ (set (match_dup 4)
+ (const_int 0))]
+ {
+ operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, 0);
+ operands[4] = simplify_gen_subreg (QImode, operands[0], HImode, 1);
+ })
next prev parent reply other threads:[~2011-06-21 16:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-20 18:39 Georg-Johann Lay
2011-06-21 7:42 ` Denis Chertykov
2011-06-21 10:05 ` Georg-Johann Lay
2011-06-21 12:21 ` Denis Chertykov
2011-06-21 12:39 ` Georg-Johann Lay
2011-06-21 13:26 ` Denis Chertykov
2011-06-21 16:47 ` Georg-Johann Lay [this message]
2011-06-21 17:31 ` Denis Chertykov
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=4E00C785.1070206@gjlay.de \
--to=avr@gjlay.de \
--cc=aesok@post.ru \
--cc=chertykov@gmail.com \
--cc=eric.weddington@atmel.com \
--cc=gcc-patches@gcc.gnu.org \
/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).