aboutsummaryrefslogtreecommitdiffstats
path: root/aarch64
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2021-09-23 15:33:06 +0200
committerXavier Leroy <xavier.leroy@college-de-france.fr>2021-09-23 15:33:06 +0200
commitc8ccecc783671fb699a33f432c34e3c1cd1dc801 (patch)
tree040fc679cf59c9842e3b4963769ba7277f97300b /aarch64
parent9e30fa95607cf357ab7c18a4773edf6b6f84c7d7 (diff)
downloadcompcert-kvx-c8ccecc783671fb699a33f432c34e3c1cd1dc801.tar.gz
compcert-kvx-c8ccecc783671fb699a33f432c34e3c1cd1dc801.zip
For __builtin_memcpy_aligned, watch out for alignment of stack offsets
Stack offsets must be multiple of 8 when using ldp/stp instructions and multiple of the transferred size when using other load/store instructions with offsets greater than 256. For simplicity, always require that the offset is multiple of 8. Fixes: #410
Diffstat (limited to 'aarch64')
-rw-r--r--aarch64/Asmexpand.ml1
1 files changed, 1 insertions, 0 deletions
diff --git a/aarch64/Asmexpand.ml b/aarch64/Asmexpand.ml
index d24a9ef6..6c58e075 100644
--- a/aarch64/Asmexpand.ml
+++ b/aarch64/Asmexpand.ml
@@ -185,6 +185,7 @@ let memcpy_small_arg sz arg tmp =
| BA_addrstack ofs ->
if offset_in_range ofs
&& offset_in_range (Ptrofs.add ofs (Ptrofs.repr (Z.of_uint sz)))
+ && Int64.rem (Z.to_int64 ofs) 8L = 0L
then (XSP, ofs)
else begin expand_addimm64 (RR1 tmp) XSP ofs; (RR1 tmp, _0) end
| _ ->