================
@@ -0,0 +1,322 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 4
+#include <arm_neon.h>
+
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +fp-armv8 
-O2 -emit-llvm -o - %s    | FileCheck %s --check-prefixes=CHECK-LE
+// RUN: %clang_cc1 -triple aarch64_be-none-linux-gnu -target-feature +fp-armv8 
-O2 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK-BE
+
+// CHECK-LE-LABEL: define dso_local %struct.int8x16x2_t @test_vldnq_s8_x2(
+// CHECK-LE-SAME: ptr nofree noundef readonly captures(none) [[PTR:%.*]]) 
local_unnamed_addr #[[ATTR0:[0-9]+]] {
+// CHECK-LE-NEXT:  entry:
+// CHECK-LE-NEXT:    [[TMP0:%.*]] = load <32 x i8>, ptr [[PTR]], align 1, 
!nontemporal [[META12:![0-9]+]]
----------------
Lukacma wrote:

Unless I’m missing something, both the existing code generation for 
non-temporal loads/stores and your new lowering appear to be incorrect. For 
these accesses, `LDNP` and `STNP` require 16-byte alignment to avoid unaligned 
accesses and potential alignment faults, as described in the [[Arm 
ARM](https://support.arm.com/documentation/ddi0487/md/-Part-B-The-AArch64-Application-Level-Architecture/-Chapter-B2-The-AArch64-Application-Level-Memory-Model/-B2-8-Alignment-support/-B2-8-2-Alignment-of-data-accesses?lang=en)](https://support.arm.com/documentation/ddi0487/md/-Part-B-The-AArch64-Application-Level-Architecture/-Chapter-B2-The-AArch64-Application-Level-Memory-Model/-B2-8-Alignment-support/-B2-8-2-Alignment-of-data-accesses?lang=en).

Your lowering bases the alignment on the vector element size, so it should not 
emit `LDNP` with `strict-align` enabled unless 16-byte alignment is guaranteed. 
However, there also appears to be an existing codegen bug: alignment is not 
checked when lowering to `LDNP`, even with `strict-align` enabled, although 
[[the corresponding check exists for 
](https://godbolt.org/z/9qx7Ebxe5)`[LDP](https://godbolt.org/z/9qx7Ebxe5)`](https://godbolt.org/z/9qx7Ebxe5).
 

Regardless as this intrinsics should always lower to the pair instruction it 
should generate operations with 16 byte alignment. It is bit counterintuitive 
from the intrinsic prototype, but the lowering should be to <2x i128> type. It 
seems the most natural type for this intrinsic  

https://github.com/llvm/llvm-project/pull/238416
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to