bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/2428] New: rep and repz are misused


From: hjl at lucon dot org
Subject: [Bug gas/2428] New: rep and repz are misused
Date: 7 Mar 2006 00:08:53 -0000

According to IA32 SDM, rep should be used with ins, outs, movs, lods, and stos,
while repz/repnz should be used with cmps and scas. Both assembler accepts
both:

address@hidden rep]$ cat good.s
        rep insb
        rep outsb
        rep movsb
        rep lodsb
        rep stosb
        repz cmpsb
        repz scasb
        repnz cmpsb
        repnz scasb
address@hidden rep]$ cat bad.s
        repz insb
        repz outsb
        repz movsb
        repz lodsb
        repz stosb
        repnz insb
        repnz outsb
        repnz movsb
        repnz lodsb
        repnz stosb
        rep cmpsb
        rep scasb
address@hidden rep]$ make
./as   -o good.o good.s
./as   -o bad.o bad.s
./objdump -d good.o

good.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:
   0:   f3 6c                   repz insb (%dx),%es:(%rdi)
   2:   f3 6e                   repz outsb %ds:(%rsi),(%dx)
   4:   f3 a4                   repz movsb %ds:(%rsi),%es:(%rdi)
   6:   f3 ac                   repz lods %ds:(%rsi),%al
   8:   f3 aa                   repz stos %al,%es:(%rdi)
   a:   f3 a6                   repz cmpsb %es:(%rdi),%ds:(%rsi)
   c:   f3 ae                   repz scas %es:(%rdi),%al
   e:   f2 a6                   repnz cmpsb %es:(%rdi),%ds:(%rsi)
  10:   f2 ae                   repnz scas %es:(%rdi),%al
./objdump -d bad.o

bad.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:
   0:   f3 6c                   repz insb (%dx),%es:(%rdi)
   2:   f3 6e                   repz outsb %ds:(%rsi),(%dx)
   4:   f3 a4                   repz movsb %ds:(%rsi),%es:(%rdi)
   6:   f3 ac                   repz lods %ds:(%rsi),%al
   8:   f3 aa                   repz stos %al,%es:(%rdi)
   a:   f2 6c                   repnz insb (%dx),%es:(%rdi)
   c:   f2 6e                   repnz outsb %ds:(%rsi),(%dx)
   e:   f2 a4                   repnz movsb %ds:(%rsi),%es:(%rdi)
  10:   f2 ac                   repnz lods %ds:(%rsi),%al
  12:   f2 aa                   repnz stos %al,%es:(%rdi)
  14:   f3 a6                   repz cmpsb %es:(%rdi),%ds:(%rsi)
  16:   f3 ae                   repz scas %es:(%rdi),%al

-- 
           Summary: rep and repz are misused
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: hjl at lucon dot org
                CC: bug-binutils at gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=2428

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]