From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: "Douglas A. Gwyn" Message-ID: <3DD3C48D.DBCE9F66@arl.army.mil> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <3DD35C73.8090404@null.net>, Subject: Re: [9fans] how to avoid a memset() optimization Date: Thu, 14 Nov 2002 15:50:33 +0000 Topicbox-Message-UUID: 1fb3b0c6-eacb-11e9-9e20-41e7f4b1d025 > > Do you really want the compiler to always generate code > > MOV R1,#0 > > MOV R2,#0 > > AND R2,R1 > > MOV R2,X(SP) Sam wrote: > Yes, yes, and yes. Optimizations which intelligently manage > register allocation are about as far as *I* appreciate. Do > precisely what I say, and no less. I intentionally mimicked the PDP-11 in my example since it supports nearly a direct mapping from C to instructions. However, on many modern machines there is no such direct mapping for many of (old) C constructs, so trying to control code generation through use of C source code is fruitless. And once you accept that principle, it is hard to tell what constitutes optimization versus simple code generation. If you want assembly language you know where to find it...