[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Aarch64: Remove assertions on immediate alignment in ldxi/stxi
From: |
Paul Cercueil |
Subject: |
[PATCH] Aarch64: Remove assertions on immediate alignment in ldxi/stxi |
Date: |
Sun, 26 Jan 2020 11:37:27 -0300 |
The immediate value can very well be unaligned with the access size and
the resulting IO access be aligned, as long as the immediate added to
the source address contained in the register is aligned.
Signed-off-by: Paul Cercueil <address@hidden>
Signed-off-by: Connor McLaughlin <address@hidden>
Tested-by: Zachary Cook <address@hidden>
---
lib/jit_aarch64-cpu.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/lib/jit_aarch64-cpu.c b/lib/jit_aarch64-cpu.c
index e036c79..63f605b 100644
--- a/lib/jit_aarch64-cpu.c
+++ b/lib/jit_aarch64-cpu.c
@@ -1602,8 +1602,7 @@ static void
_ldxi_s(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
jit_int32_t reg;
- assert(!(i0 & 1));
- if (i0 >= 0 && i0 <= 8191)
+ if (i0 >= 0 && i0 <= 8191 && !(i0 & 1))
LDRSHI(r0, r1, i0 >> 1);
else if (i0 > -256 && i0 < 0)
LDURSH(r0, r1, i0 & 0x1ff);
@@ -1628,8 +1627,7 @@ static void
_ldxi_us(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
jit_int32_t reg;
- assert(!(i0 & 1));
- if (i0 >= 0 && i0 <= 8191)
+ if (i0 >= 0 && i0 <= 8191 && !(i0 & 1))
LDRHI(r0, r1, i0 >> 1);
else if (i0 > -256 && i0 < 0)
LDURH(r0, r1, i0 & 0x1ff);
@@ -1648,8 +1646,7 @@ static void
_ldxi_i(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
jit_int32_t reg;
- assert(!(i0 & 3));
- if (i0 >= 0 && i0 <= 16383)
+ if (i0 >= 0 && i0 <= 16383 && !(i0 & 3))
LDRSWI(r0, r1, i0 >> 2);
else if (i0 > -256 && i0 < 0)
LDURSW(r0, r1, i0 & 0x1ff);
@@ -1674,8 +1671,7 @@ static void
_ldxi_ui(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
jit_int32_t reg;
- assert(!(i0 & 3));
- if (i0 >= 0 && i0 <= 16383)
+ if (i0 >= 0 && i0 <= 16383 && !(i0 & 3))
LDRWI(r0, r1, i0 >> 2);
else if (i0 > -256 && i0 < 0)
LDURW(r0, r1, i0 & 0x1ff);
@@ -1694,8 +1690,7 @@ static void
_ldxi_l(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
{
jit_int32_t reg;
- assert(!(i0 & 7));
- if (i0 >= 0 && i0 <= 32767)
+ if (i0 >= 0 && i0 <= 32767 && !(i0 & 7))
LDRI(r0, r1, i0 >> 3);
else if (i0 > -256 && i0 < 0)
LDUR(r0, r1, i0 & 0x1ff);
@@ -1767,8 +1762,7 @@ static void
_stxi_s(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
jit_int32_t reg;
- assert(!(i0 & 1));
- if (i0 >= 0 && i0 <= 8191)
+ if (i0 >= 0 && i0 <= 8191 && !(i0 & 1))
STRHI(r1, r0, i0 >> 1);
else if (i0 > -256 && i0 < 0)
STURH(r1, r0, i0 & 0x1ff);
@@ -1784,8 +1778,7 @@ static void
_stxi_i(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
jit_int32_t reg;
- assert(!(i0 & 3));
- if (i0 >= 0 && i0 <= 16383)
+ if (i0 >= 0 && i0 <= 16383 && !(i0 & 3))
STRWI(r1, r0, i0 >> 2);
else if (i0 > -256 && i0 < 0)
STURW(r1, r0, i0 & 0x1ff);
@@ -1801,8 +1794,7 @@ static void
_stxi_l(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, jit_int32_t r1)
{
jit_int32_t reg;
- assert(!(i0 & 7));
- if (i0 >= 0 && i0 <= 32767)
+ if (i0 >= 0 && i0 <= 32767 && !(i0 & 7))
STRI(r1, r0, i0 >> 3);
else if (i0 > -256 && i0 < 0)
STUR(r1, r0, i0 & 0x1ff);
--
2.24.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Aarch64: Remove assertions on immediate alignment in ldxi/stxi,
Paul Cercueil <=