From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15071 invoked by alias); 16 Feb 2006 02:49:51 -0000 Received: (qmail 15063 invoked by uid 22791); 16 Feb 2006 02:49:50 -0000 X-Spam-Check-By: sourceware.org Received: from dair.pair.com (HELO dair.pair.com) (209.68.1.49) by sourceware.org (qpsmtpd/0.31) with SMTP; Thu, 16 Feb 2006 02:49:49 +0000 Received: (qmail 6118 invoked by uid 20157); 16 Feb 2006 02:49:46 -0000 Date: Thu, 16 Feb 2006 02:49:00 -0000 From: Hans-Peter Nilsson To: Sylvain Munaut cc: gcc@gcc.gnu.org Subject: Re: Design a microcontroller for gcc In-Reply-To: <43F3C6F8.7080007@246tNt.com> Message-ID: References: <43F2666E.70703@246tNt.com> <43F3C6F8.7080007@246tNt.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2006-02/txt/msg00276.txt.bz2 On Thu, 16 Feb 2006, Sylvain Munaut wrote: > What I was thinking for the moment was to have : > - sign is always the msb of the last ALU output > - add/sub to modify all flags > - move/xor/and/not/or only affect zero (and sign) > - shift operations always affect carry and zero > - Have some specific instructions like compare and test, but theses > would only operate on registers (and not on immediate) No, really. Just use compare insns. (And perhaps some way for carry propagation for multi-word add/sub, if that mechanism interferes. BTW, carry-out from shifts is very rarely used in compiled code.) > What's so bad about have the flag as side-effects ? Besides what DJ said about performance (both pros and cons there), the problem is as I said with port complexity, because of the way you have to handle condition codes in gcc. (_Should_ now, _have_to_ in the future -- or actually now, as you say you need scheduling.) Flag setting really should be explicit, so with your way, you have to show that add and sub etc. also set condition codes. And that's where you notice the complexity in the port, because (partly because of gcc pecularities) unless you want to lose performancewise, you need to show that most of the time, the flag register result is just clobbered by those operations and not used. Anyway, at least keep a way to add reg+reg and reg+integer, load and store of memory and load of integer and address without condition code effects and your port has a chance to avoid the related bloat. Sorry, I won't spend the time to spell out the details. Whatever: if you're determined on your way to do it and won't take advice you asked for, by all means feel free. You _have_ been warned, though. brgds, H-P