1 ; RUN: llc -mtriple=arm64-apple-ios -mattr=+strict-align < %s | FileCheck %s 2 3 ; Small (16 bytes here) unaligned memcpy() should be a function call if 4 ; strict-alignment is turned on. 5 define void @t0(i8* %out, i8* %in) { 6 ; CHECK-LABEL: t0: 7 ; CHECK: orr w2, wzr, #0x10 8 ; CHECK-NEXT: bl _memcpy 9 entry: 10 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %out, i8* %in, i64 16, i1 false) 11 ret void 12 } 13 14 ; Small (16 bytes here) aligned memcpy() should be inlined even if 15 ; strict-alignment is turned on. 16 define void @t1(i8* align 8 %out, i8* align 8 %in) { 17 ; CHECK-LABEL: t1: 18 ; CHECK: ldp x{{[0-9]+}}, x{{[0-9]+}}, [x1] 19 ; CHECK-NEXT: stp x{{[0-9]+}}, x{{[0-9]+}}, [x0] 20 entry: 21 call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %out, i8* align 8 %in, i64 16, i1 false) 22 ret void 23 } 24 25 ; Tiny (4 bytes here) unaligned memcpy() should be inlined with byte sized 26 ; loads and stores if strict-alignment is turned on. 27 define void @t2(i8* %out, i8* %in) { 28 ; CHECK-LABEL: t2: 29 ; CHECK: ldrb w{{[0-9]+}}, [x1, #3] 30 ; CHECK-NEXT: ldrb w{{[0-9]+}}, [x1, #2] 31 ; CHECK-NEXT: ldrb w{{[0-9]+}}, [x1, #1] 32 ; CHECK-NEXT: ldrb w{{[0-9]+}}, [x1] 33 ; CHECK-NEXT: strb w{{[0-9]+}}, [x0, #3] 34 ; CHECK-NEXT: strb w{{[0-9]+}}, [x0, #2] 35 ; CHECK-NEXT: strb w{{[0-9]+}}, [x0, #1] 36 ; CHECK-NEXT: strb w{{[0-9]+}}, [x0] 37 entry: 38 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %out, i8* %in, i64 4, i1 false) 39 ret void 40 } 41 42 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) 43