xref: /aosp_15_r20/external/llvm/test/CodeGen/AArch64/arm64-unaligned_ldst.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=arm64 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; rdar://r11231896
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Workerdefine void @t1(i8* nocapture %a, i8* nocapture %b) nounwind {
5*9880d681SAndroid Build Coastguard Workerentry:
6*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: t1:
7*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: orr
8*9880d681SAndroid Build Coastguard Worker; CHECK: ldr [[X0:x[0-9]+]], [x1]
9*9880d681SAndroid Build Coastguard Worker; CHECK: str [[X0]], [x0]
10*9880d681SAndroid Build Coastguard Worker  %tmp1 = bitcast i8* %b to i64*
11*9880d681SAndroid Build Coastguard Worker  %tmp2 = bitcast i8* %a to i64*
12*9880d681SAndroid Build Coastguard Worker  %tmp3 = load i64, i64* %tmp1, align 1
13*9880d681SAndroid Build Coastguard Worker  store i64 %tmp3, i64* %tmp2, align 1
14*9880d681SAndroid Build Coastguard Worker  ret void
15*9880d681SAndroid Build Coastguard Worker}
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdefine void @t2(i8* nocapture %a, i8* nocapture %b) nounwind {
18*9880d681SAndroid Build Coastguard Workerentry:
19*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: t2:
20*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: orr
21*9880d681SAndroid Build Coastguard Worker; CHECK: ldr [[W0:w[0-9]+]], [x1]
22*9880d681SAndroid Build Coastguard Worker; CHECK: str [[W0]], [x0]
23*9880d681SAndroid Build Coastguard Worker  %tmp1 = bitcast i8* %b to i32*
24*9880d681SAndroid Build Coastguard Worker  %tmp2 = bitcast i8* %a to i32*
25*9880d681SAndroid Build Coastguard Worker  %tmp3 = load i32, i32* %tmp1, align 1
26*9880d681SAndroid Build Coastguard Worker  store i32 %tmp3, i32* %tmp2, align 1
27*9880d681SAndroid Build Coastguard Worker  ret void
28*9880d681SAndroid Build Coastguard Worker}
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdefine void @t3(i8* nocapture %a, i8* nocapture %b) nounwind {
31*9880d681SAndroid Build Coastguard Workerentry:
32*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: t3:
33*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: orr
34*9880d681SAndroid Build Coastguard Worker; CHECK: ldrh [[W0:w[0-9]+]], [x1]
35*9880d681SAndroid Build Coastguard Worker; CHECK: strh [[W0]], [x0]
36*9880d681SAndroid Build Coastguard Worker  %tmp1 = bitcast i8* %b to i16*
37*9880d681SAndroid Build Coastguard Worker  %tmp2 = bitcast i8* %a to i16*
38*9880d681SAndroid Build Coastguard Worker  %tmp3 = load i16, i16* %tmp1, align 1
39*9880d681SAndroid Build Coastguard Worker  store i16 %tmp3, i16* %tmp2, align 1
40*9880d681SAndroid Build Coastguard Worker  ret void
41*9880d681SAndroid Build Coastguard Worker}
42