amd64: plug spurious cld instructions

ABI already guarantees the direction is forward. Note this does not take care
of i386-specific cld's.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21906
This commit is contained in:
Mateusz Guzik 2019-10-08 21:14:11 +00:00
parent f189761366
commit fa43c5d49e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353327
2 changed files with 6 additions and 24 deletions

View File

@ -231,7 +231,7 @@ inl(u_int port)
static __inline void
insb(u_int port, void *addr, size_t count)
{
__asm __volatile("cld; rep; insb"
__asm __volatile("rep; insb"
: "+D" (addr), "+c" (count)
: "d" (port)
: "memory");
@ -240,7 +240,7 @@ insb(u_int port, void *addr, size_t count)
static __inline void
insw(u_int port, void *addr, size_t count)
{
__asm __volatile("cld; rep; insw"
__asm __volatile("rep; insw"
: "+D" (addr), "+c" (count)
: "d" (port)
: "memory");
@ -249,7 +249,7 @@ insw(u_int port, void *addr, size_t count)
static __inline void
insl(u_int port, void *addr, size_t count)
{
__asm __volatile("cld; rep; insl"
__asm __volatile("rep; insl"
: "+D" (addr), "+c" (count)
: "d" (port)
: "memory");
@ -285,7 +285,7 @@ outl(u_int port, u_int data)
static __inline void
outsb(u_int port, const void *addr, size_t count)
{
__asm __volatile("cld; rep; outsb"
__asm __volatile("rep; outsb"
: "+S" (addr), "+c" (count)
: "d" (port));
}
@ -293,7 +293,7 @@ outsb(u_int port, const void *addr, size_t count)
static __inline void
outsw(u_int port, const void *addr, size_t count)
{
__asm __volatile("cld; rep; outsw"
__asm __volatile("rep; outsw"
: "+S" (addr), "+c" (count)
: "d" (port));
}
@ -301,7 +301,7 @@ outsw(u_int port, const void *addr, size_t count)
static __inline void
outsl(u_int port, const void *addr, size_t count)
{
__asm __volatile("cld; rep; outsl"
__asm __volatile("rep; outsl"
: "+S" (addr), "+c" (count)
: "d" (port));
}

View File

@ -280,7 +280,6 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
else {
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: movb (%2),%%al \n\
stosb \n\
loop 1b" :
@ -301,7 +300,6 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
else {
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: movw (%2),%%ax \n\
stosw \n\
loop 1b" :
@ -322,7 +320,6 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
else {
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: movl (%2),%%eax \n\
stosl \n\
loop 1b" :
@ -367,7 +364,6 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
int _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: inb %w2,%%al \n\
stosb \n\
incl %2 \n\
@ -380,7 +376,6 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
movsb" :
"=D" (addr), "=c" (count), "=S" (_port_) :
@ -399,7 +394,6 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
int _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: inw %w2,%%ax \n\
stosw \n\
addl $2,%2 \n\
@ -412,7 +406,6 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
movsw" :
"=D" (addr), "=c" (count), "=S" (_port_) :
@ -431,7 +424,6 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
int _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: inl %w2,%%eax \n\
stosl \n\
addl $4,%2 \n\
@ -444,7 +436,6 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
movsl" :
"=D" (addr), "=c" (count), "=S" (_port_) :
@ -559,7 +550,6 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
else {
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsb \n\
movb %%al,(%2) \n\
loop 1b" :
@ -580,7 +570,6 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
else {
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsw \n\
movw %%ax,(%2) \n\
loop 1b" :
@ -601,7 +590,6 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
else {
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsl \n\
movl %%eax,(%2) \n\
loop 1b" :
@ -647,7 +635,6 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
int _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsb \n\
outb %%al,%w0 \n\
incl %0 \n\
@ -660,7 +647,6 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
movsb" :
"=D" (_port_), "=S" (addr), "=c" (count) :
@ -679,7 +665,6 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
int _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsw \n\
outw %%ax,%w0 \n\
addl $2,%0 \n\
@ -692,7 +677,6 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
movsw" :
"=D" (_port_), "=S" (addr), "=c" (count) :
@ -711,7 +695,6 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
int _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsl \n\
outl %%eax,%w0 \n\
addl $4,%0 \n\
@ -724,7 +707,6 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
movsl" :
"=D" (_port_), "=S" (addr), "=c" (count) :