X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Received: by 10.50.80.18 with SMTP id n18mr420220igx.1.1455671037559; Tue, 16 Feb 2016 17:03:57 -0800 (PST) X-Received: by 10.182.40.227 with SMTP id a3mr231607obl.14.1455671037540; Tue, 16 Feb 2016 17:03:57 -0800 (PST) Newsgroups: comp.os.msdos.djgpp Date: Tue, 16 Feb 2016 17:03:57 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse AT google DOT com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=65.13.115.246; posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO NNTP-Posting-Host: 65.13.115.246 References: <201601312013 DOT u0VKDC4O017569 AT delorie DOT com> <56AF7CFB DOT 8010507 AT iki DOT fi> <83twlsyya8 DOT fsf AT gnu DOT org> <56B03232 DOT 8040802 AT iki DOT fi> <7c07fdd8-c7f5-4cba-b83d-42407a6717f7 AT googlegroups DOT com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4aabfeab-8bd6-416a-a32d-b15db7c9bc38@googlegroups.com> Subject: Re: ANNOUNCE: Update of DJGPP port of gcc-5.3.0 From: "rugxulo AT gmail DOT com [via djgpp AT delorie DOT com]" Injection-Date: Wed, 17 Feb 2016 01:03:57 +0000 Content-Type: text/plain; charset=ISO-8859-1 Bytes: 4873 Lines: 101 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Hi, On Tuesday, February 16, 2016 at 3:19:21 AM UTC-6, Wiktor S. wrote: > >> This was a one-line problem in assembly code: > >> > >> rep/movsl (%esi),(%edi) > >> > >> Newest as.exe generates wrong binary code on the above line. After > >> changing to "rep movsl" with space it worked. > >> > >> I don't know if rep/movsl syntax is correct or not, but if it is > >> not, AS should fail instead of silently generating bad code. > > > > Do you mean that GCC itself is generating [sic] "rep/movsl" or is it > > some inline or handwritten (external) assembly file? > > It is in handwritten assembly. > > The dissasembled (wrong) instruction is > > rep add %eax,%esi I don't know if this is truly a bug or not. I also don't know if the BinUtils maintainers will fix it. I also don't know what Juan plans to do (apparently BNU2251BR4.ZIP is already on mirrors, uploaded yesterday). I would not necessarily rush to delete BNU226B.ZIP just yet. Yes, I see d_copy.s (circa 1998) from Q1SOURCE.ZIP has this line. That's obviously not your fault, only the original author's, but I suspect that BinUtils maintainers will just tell you to change your code locally. While I'm not sure exactly, I've never noticed anybody using "rep/..." in their sources (with a slash). Normally you only see tabs or blanks, but I guess other variations exist as well. I did see "rep ; ret" a few years back, but I wasn't 100% comfortable using it (and don't know if it really helped speed much). That's my point here, mostly. "rep" (and other prefixes) are sometimes used in weird ways. I think extra prefixes are usually just ignored. And sometimes new instructions will use a formerly-invalid combo since nobody was using it for anything anyways. Not sure if "as --march=..." will help you here or not. For instance, I was already vaguely aware that "pause" [SSE2?] was really "rep nop". And a quick check shows that it didn't stop there. Apparently "lzcnt" [SSE4.2?] is really "rep bsr". So, for testing, here's a simple FASM example: N.B. FASM dude is very savvy, so if his accepts something, I assume he has good reason. He supports (AFAIK) all modern instructions, including AVX and probably the others (MOVBE, etc). EDIT: Even NASM 2.11.08 doesn't complain. === blah.asm begins === use32 format coff nop rep add eax,ebx rep xor eax,ebx rep aam 16 nop rep ret rep nop nop bsr eax,[ebx] lzcnt eax,[ebx] nop ret === blah.asm ends === And here's what (DJGPP) Objdump 2.25.1 says: === objdump.out begins === blah.o: file format coff-go32 Disassembly of section .flat: 00000000 <.flat>: 0: 90 nop 1: f3 01 d8 repz add eax,ebx 4: f3 31 d8 repz xor eax,ebx 7: f3 d4 10 repz aam 0x10 a: 90 nop b: f3 c3 repz ret d: f3 90 pause f: 90 nop 10: 0f bd 03 bsr eax,DWORD PTR [ebx] 13: f3 0f bd 03 lzcnt eax,DWORD PTR [ebx] 17: 90 nop 18: c3 ret === objdump.out ends === Now, of course you can argue that "rep/movsl" isn't anywhere close to "rep add", so that's not intentional and presumably bad. I don't disagree, just saying, it's probably hard to catch every possible error like this.