1 ; RUN: llc < %s -mtriple=arm64-eabi -aarch64-neon-syntax=apple -mcpu=cyclone -mattr=+slow-misaligned-128store | FileCheck %s
2 %struct.X = type <{ i32, i64, i64 }>
4 define void @foo1(ptr %p, i64 %val) nounwind {
6 ; CHECK: stur w1, [x0, #-4]
8 %tmp1 = trunc i64 %val to i32
9 %ptr = getelementptr inbounds i32, ptr %p, i64 -1
10 store i32 %tmp1, ptr %ptr, align 4
13 define void @foo2(ptr %p, i64 %val) nounwind {
15 ; CHECK: sturh w1, [x0, #-2]
17 %tmp1 = trunc i64 %val to i16
18 %ptr = getelementptr inbounds i16, ptr %p, i64 -1
19 store i16 %tmp1, ptr %ptr, align 2
22 define void @foo3(ptr %p, i64 %val) nounwind {
24 ; CHECK: sturb w1, [x0, #-1]
26 %tmp1 = trunc i64 %val to i8
27 %ptr = getelementptr inbounds i8, ptr %p, i64 -1
28 store i8 %tmp1, ptr %ptr, align 1
31 define void @foo4(ptr %p, i32 %val) nounwind {
33 ; CHECK: sturh w1, [x0, #-2]
35 %tmp1 = trunc i32 %val to i16
36 %ptr = getelementptr inbounds i16, ptr %p, i32 -1
37 store i16 %tmp1, ptr %ptr, align 2
40 define void @foo5(ptr %p, i32 %val) nounwind {
42 ; CHECK: sturb w1, [x0, #-1]
44 %tmp1 = trunc i32 %val to i8
45 %ptr = getelementptr inbounds i8, ptr %p, i32 -1
46 store i8 %tmp1, ptr %ptr, align 1
50 define void @foo(ptr nocapture %p) nounwind optsize ssp {
53 ; CHECK: stur xzr, [x0, #12]
54 ; CHECK-NEXT: stur xzr, [x0, #4]
56 %B = getelementptr inbounds %struct.X, ptr %p, i64 0, i32 1
57 call void @llvm.memset.p0.i64(ptr %B, i8 0, i64 16, i1 false)
61 declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind
63 ; Unaligned 16b stores are split into 8b stores for performance.
66 ; CHECK-LABEL: unaligned:
68 ; CHECK: str d[[REG:[0-9]+]], [x0]
69 ; CHECK: ext.16b v[[REG2:[0-9]+]], v[[REG]], v[[REG]], #8
70 ; CHECK: str d[[REG2]], [x0, #8]
71 define void @unaligned(ptr %p, <4 x i32> %v) nounwind {
72 store <4 x i32> %v, ptr %p, align 4
76 ; CHECK-LABEL: aligned:
78 define void @aligned(ptr %p, <4 x i32> %v) nounwind {
79 store <4 x i32> %v, ptr %p
83 ; Don't split one and two byte aligned stores.
86 ; CHECK-LABEL: twobytealign:
88 define void @twobytealign(ptr %p, <4 x i32> %v) nounwind {
89 store <4 x i32> %v, ptr %p, align 2
92 ; CHECK-LABEL: onebytealign:
94 define void @onebytealign(ptr %p, <4 x i32> %v) nounwind {
95 store <4 x i32> %v, ptr %p, align 1