Skip to content

Commit

Permalink
[arch][arm64][mmio] add 'Z' to the mmio write accessor inline asm
Browse files Browse the repository at this point in the history
This allows the compiler to use the xzr register if writing a zero
value, instead of uselessly moving 0 into a register first.
  • Loading branch information
travisg committed May 25, 2024
1 parent 7791ec0 commit 6c14941
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/arm64/include/arch/reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
})

#define _ARCH_MMIO_WRITE8(addr, val) \
__asm__ volatile("strb %w1, %0" : "=m"(*(addr)) : "r"(val) : "memory")
__asm__ volatile("strb %w1, %0" : "=m"(*(addr)) : "Zr"(val) : "memory")
#define _ARCH_MMIO_WRITE16(addr, val) \
__asm__ volatile("strh %w1, %0" : "=m"(*(addr)): "r"(val) : "memory")
__asm__ volatile("strh %w1, %0" : "=m"(*(addr)): "Zr"(val) : "memory")
#define _ARCH_MMIO_WRITE32(addr, val) \
__asm__ volatile("str %w1, %0" : "=m"(*(addr)) : "r"(val) : "memory")
__asm__ volatile("str %w1, %0" : "=m"(*(addr)) : "Zr"(val) : "memory")
#define _ARCH_MMIO_WRITE64(addr, val) \
__asm__ volatile("str %1, %0" : "=m"(*(addr)) : "r"(val) : "memory")
__asm__ volatile("str %1, %0" : "=m"(*(addr)) : "Zr"(val) : "memory")

0 comments on commit 6c14941

Please sign in to comment.