From: remi@remlab.net
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 1/2] aarch64: relax byte-swap assembler constraints
Date: Sat, 3 Sep 2022 18:05:17 +0300
Message-ID: <20220903150518.169643-1-remi@remlab.net> (raw)
From: Rémi Denis-Courmont <remi@remlab.net>
There are no particular reasons to force the compiler to use the same
register as output and input operand. This forces an extra MOV
instruction if the input value needs to be reused after the swap.
In most cases, this makes no differences, as the compiler will seleect
the same register for both operands either way.
---
libavutil/aarch64/bswap.h | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/libavutil/aarch64/bswap.h b/libavutil/aarch64/bswap.h
index 1e735c52cf..7abca657ba 100644
--- a/libavutil/aarch64/bswap.h
+++ b/libavutil/aarch64/bswap.h
@@ -28,22 +28,28 @@
#define av_bswap16 av_bswap16
static av_always_inline av_const unsigned av_bswap16(unsigned x)
{
- __asm__("rev16 %w0, %w0" : "+r"(x));
- return x;
+ unsigned y;
+
+ __asm__("rev16 %w0, %w1" : "=r"(y) : "r"(x));
+ return y;
}
#define av_bswap32 av_bswap32
static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
- __asm__("rev %w0, %w0" : "+r"(x));
- return x;
+ uint32_t y;
+
+ __asm__("rev %w0, %w1" : "=r"(y) : "r"(x));
+ return y;
}
#define av_bswap64 av_bswap64
static av_always_inline av_const uint64_t av_bswap64(uint64_t x)
{
- __asm__("rev %0, %0" : "+r"(x));
- return x;
+ uint64_t y;
+
+ __asm__("rev %0, %1" : "=r"(y) : "r"(x));
+ return y;
}
#endif /* HAVE_INLINE_ASM */
--
2.37.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
reply other threads:[~2022-09-03 15:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220903150518.169643-1-remi@remlab.net \
--to=remi@remlab.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git