public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch,AVR]: Tweak 8-bit parity expansion
@ 2011-10-28 14:34 Georg-Johann Lay
  2011-10-28 14:49 ` Denis Chertykov
  0 siblings, 1 reply; 2+ messages in thread
From: Georg-Johann Lay @ 2011-10-28 14:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: Denis Chertykov, Eric Weddington

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

This is minor tweak to support 8-bit parity.

Otherwise, the input operand of 8-bit values will be extended before parity
computation.

The final representation as libgcc call is not generated in split1 and no more
in expand. Notice that

- combine is not allowed to propagate hard regs into zero-extends.
- combine does not try parity:QI

Ok for trunk?

Johann

	* config/avr/avr.md (parityhi2): Expand allowing pseudos.
	(*parityhi2): New pre-reload insn-and-split to map 16-bit parity
	to the libgcc insn.
	(*parityqihi2): Same for 8-bit parity.



[-- Attachment #2: tweak-parity-8.diff --]
[-- Type: text/x-patch, Size: 1580 bytes --]

Index: config/avr/avr.md
===================================================================
--- config/avr/avr.md	(revision 180605)
+++ config/avr/avr.md	(working copy)
@@ -4288,15 +4288,41 @@ (define_insn "delay_cycles_4"
 
 ;; Parity
 
+;; Postpone expansion of 16-bit parity to libgcc call until after combine for
+;; better 8-bit parity recognition.
+
 (define_expand "parityhi2"
+  [(parallel [(set (match_operand:HI 0 "register_operand" "")
+                   (parity:HI (match_operand:HI 1 "register_operand" "")))
+              (clobber (reg:HI 24))])])
+
+(define_insn_and_split "*parityhi2"
+  [(set (match_operand:HI 0 "register_operand"           "=r")
+        (parity:HI (match_operand:HI 1 "register_operand" "r")))
+   (clobber (reg:HI 24))]
+  "!reload_completed"
+  { gcc_unreachable(); }
+  "&& 1"
   [(set (reg:HI 24)
-        (match_operand:HI 1 "register_operand" ""))
+        (match_dup 1))
    (set (reg:HI 24)
         (parity:HI (reg:HI 24)))
-   (set (match_operand:HI 0 "register_operand" "")
-        (reg:HI 24))]
-  ""
-  "")
+   (set (match_dup 0)
+        (reg:HI 24))])
+
+(define_insn_and_split "*parityqihi2"
+  [(set (match_operand:HI 0 "register_operand"           "=r")
+        (parity:HI (match_operand:QI 1 "register_operand" "r")))
+   (clobber (reg:HI 24))]
+  "!reload_completed"
+  { gcc_unreachable(); }
+  "&& 1"
+  [(set (reg:QI 24)
+        (match_dup 1))
+   (set (reg:HI 24)
+        (zero_extend:HI (parity:QI (reg:QI 24))))
+   (set (match_dup 0)
+        (reg:HI 24))])
 
 (define_expand "paritysi2"
   [(set (reg:SI 22)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch,AVR]: Tweak 8-bit parity expansion
  2011-10-28 14:34 [Patch,AVR]: Tweak 8-bit parity expansion Georg-Johann Lay
@ 2011-10-28 14:49 ` Denis Chertykov
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Chertykov @ 2011-10-28 14:49 UTC (permalink / raw)
  To: Georg-Johann Lay; +Cc: gcc-patches, Eric Weddington

2011/10/28 Georg-Johann Lay <avr@gjlay.de>:
> This is minor tweak to support 8-bit parity.
>
> Otherwise, the input operand of 8-bit values will be extended before parity
> computation.
>
> The final representation as libgcc call is not generated in split1 and no more
> in expand. Notice that
>
> - combine is not allowed to propagate hard regs into zero-extends.
> - combine does not try parity:QI
>
> Ok for trunk?
>
> Johann
>
>        * config/avr/avr.md (parityhi2): Expand allowing pseudos.
>        (*parityhi2): New pre-reload insn-and-split to map 16-bit parity
>        to the libgcc insn.
>        (*parityqihi2): Same for 8-bit parity.
>

Approved.

Denis.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-28 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-28 14:34 [Patch,AVR]: Tweak 8-bit parity expansion Georg-Johann Lay
2011-10-28 14:49 ` Denis Chertykov

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).