754 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py2; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size | \3; RUN: FileCheck %s --check-prefixes=COMMON,CHECK-NO-SA4; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+strict-align | \5; RUN: FileCheck %s --check-prefixes=COMMON,CHECK-SA6 7target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"8target triple = "thumbv7m-arm-unknown-eabi"9 10;;;;;;;;;;;;11; Align 1, 112;;;;;;;;;;;;13 14define void @memcpy_0(ptr %d, ptr %s) {15;16; with/without strict-align:17;18; ldrb r1, [r1]19; strb r1, [r0]20;21; COMMON-LABEL: 'memcpy_0'22; COMMON-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr %d, ptr %s, i32 1, i1 false)23; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void24;25entry:26 call void @llvm.memcpy.p0.p0.i32(ptr %d, ptr %s, i32 1, i1 false)27 ret void28}29 30define void @memcpy_1(ptr %d, ptr %s) {31;32; with/without strict-align:33;34; ldrb r1, [r1]35; strb r1, [r0]36;37; COMMON-LABEL: 'memcpy_1'38; COMMON-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 1, i1 false)39; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void40;41entry:42 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 1, i1 false)43 ret void44}45 46define void @memcpy_2(ptr %d, ptr %s) {47;48; no strict-align:49;50; ldrh r1, [r1]51; strh r1, [r0]52;53; strict-align:54;55; ldrb r2, [r1]56; ldrb r1, [r1, #1]57; strb r1, [r0, #1]58; strb r2, [r0]59;60; CHECK-NO-SA-LABEL: 'memcpy_2'61; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 2, i1 false)62; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void63;64; CHECK-SA-LABEL: 'memcpy_2'65; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 2, i1 false)66; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void67;68entry:69 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 2, i1 false)70 ret void71}72 73define void @memcpy_3(ptr %d, ptr %s) {74;75; no strict-align:76;77; ldrb r2, [r1, #2]78; strb r2, [r0, #2]79; ldrh r1, [r1]80; strh r1, [r0]81;82; strict-align:83;84; ldrb r2, [r1]85; ldrb r3, [r1, #1]86; ldrb r1, [r1, #2]87; strb r1, [r0, #2]88; strb r3, [r0, #1]89; strb r2, [r0]90;91; CHECK-NO-SA-LABEL: 'memcpy_3'92; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 3, i1 false)93; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void94;95; CHECK-SA-LABEL: 'memcpy_3'96; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 6 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 3, i1 false)97; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void98;99entry:100 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 3, i1 false)101 ret void102}103 104define void @memcpy_4(ptr %d, ptr %s) {105;106; no strict-align:107;108; ldr r1, [r1]109; str r1, [r0]110;111; strict-align:112;113; ldrb.w r12, [r1]114; ldrb r3, [r1, #1]115; ldrb r2, [r1, #2]116; ldrb r1, [r1, #3]117; strb r1, [r0, #3]118; strb r2, [r0, #2]119; strb r3, [r0, #1]120; strb.w r12, [r0]121;122; CHECK-NO-SA-LABEL: 'memcpy_4'123; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 4, i1 false)124; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void125;126; CHECK-SA-LABEL: 'memcpy_4'127; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 4, i1 false)128; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void129;130entry:131 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 4, i1 false)132 ret void133}134 135define void @memcpy_8(ptr %d, ptr %s) {136;137; no strict-align:138;139; ldr r2, [r1]140; ldr r1, [r1, #4]141; str r1, [r0, #4]142; str r2, [r0]143;144; strict-align:145;146; push {r7, lr}147; movs r2, #8148; bl __aeabi_memcpy149; pop {r7, pc}150;151; COMMON-LABEL: 'memcpy_8'152; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 8, i1 false)153; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void154;155entry:156 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 8, i1 false)157 ret void158}159 160define void @memcpy_16(ptr %d, ptr %s) {161;162; no strict-align:163;164; ldr.w r12, [r1]165; ldr r3, [r1, #4]166; ldr r2, [r1, #8]167; ldr r1, [r1, #12]168; str r1, [r0, #12]169; str r2, [r0, #8]170; str r3, [r0, #4]171; str.w r12, [r0]172;173; strict-align:174;175; push {r7, lr}176; movs r2, #8177; bl __aeabi_memcpy178; pop {r7, pc}179;180; CHECK-NO-SA-LABEL: 'memcpy_16'181; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 16, i1 false)182; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void183;184; CHECK-SA-LABEL: 'memcpy_16'185; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 16, i1 false)186; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void187;188entry:189 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 16, i1 false)190 ret void191}192 193define void @memcpy_32(ptr %d, ptr %s, i32 %N) {194;195; with/without strict-align:196;197; movs r2, #32198; bl __aeabi_memcpy199;200; COMMON-LABEL: 'memcpy_32'201; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 32, i1 false)202; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void203;204entry:205 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 32, i1 false)206 ret void207}208 209define void @memcpy_N(ptr %d, ptr %s, i32 %N) {210;211; with/without strict-align:212;213; bl __aeabi_memcpy214;215; COMMON-LABEL: 'memcpy_N'216; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 %N, i1 false)217; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void218;219entry:220 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 %N, i1 false)221 ret void222}223 224;;;;;;;;;;;;;225; Align 2, 2226;;;;;;;;;;;;;227 228define void @memcpy_1_al2(ptr %d, ptr %s) {229;230; with/without strict-align:231;232; ldrb r1, [r1]233; strb r1, [r0]234;235; COMMON-LABEL: 'memcpy_1_al2'236; COMMON-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 1, i1 false)237; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void238;239entry:240 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 1, i1 false)241 ret void242}243 244define void @memcpy_2_al2(ptr %d, ptr %s) {245;246; with/without strict-align:247;248; ldrh r1, [r1]249; strh r1, [r0]250;251; COMMON-LABEL: 'memcpy_2_al2'252; COMMON-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 2, i1 false)253; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void254;255entry:256 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 2, i1 false)257 ret void258}259 260define void @memcpy_3_al2(ptr %d, ptr %s) {261;262; with/without strict-align:263;264; ldrb r2, [r1, #2]265; strb r2, [r0, #2]266; ldrh r1, [r1]267; strh r1, [r0]268;269; COMMON-LABEL: 'memcpy_3_al2'270; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 3, i1 false)271; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void272;273entry:274 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 3, i1 false)275 ret void276}277 278define void @memcpy_4_al2(ptr %d, ptr %s) {279;280; no strict-align:281;282; ldr r1, [r1]283; str r1, [r0]284;285; strict-align:286;287; ldrh r2, [r1, #2]288; strh r2, [r0, #2]289; ldrh r1, [r1]290; strh r1, [r0]291;292; CHECK-NO-SA-LABEL: 'memcpy_4_al2'293; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 4, i1 false)294; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void295;296; CHECK-SA-LABEL: 'memcpy_4_al2'297; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 4, i1 false)298; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void299;300entry:301 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 4, i1 false)302 ret void303}304 305define void @memcpy_8_al2(ptr %d, ptr %s) {306;307; no strict-align:308;309; ldr r2, [r1]310; ldr r1, [r1, #4]311; str r1, [r0, #4]312; str r2, [r0]313;314; strict-align:315;316; ldrh r2, [r1, #6]317; strh r2, [r0, #6]318; ldrh r2, [r1, #4]319; strh r2, [r0, #4]320; ldrh r2, [r1, #2]321; strh r2, [r0, #2]322; ldrh r1, [r1]323; strh r1, [r0]324;325; CHECK-NO-SA-LABEL: 'memcpy_8_al2'326; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 8, i1 false)327; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void328;329; CHECK-SA-LABEL: 'memcpy_8_al2'330; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 8, i1 false)331; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void332;333entry:334 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 8, i1 false)335 ret void336}337 338define void @memcpy_16_al2(ptr %d, ptr %s) {339;340; no strict-align:341;342; ldr.w r12, [r1]343; ldr r3, [r1, #4]344; ldr r2, [r1, #8]345; ldr r1, [r1, #12]346; str r1, [r0, #12]347; str r2, [r0, #8]348; str r3, [r0, #4]349; str.w r12, [r0]350;351; strict-align:352;353; movs r2, #16354; bl __aeabi_memcpy355;356; CHECK-NO-SA-LABEL: 'memcpy_16_al2'357; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 16, i1 false)358; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void359;360; CHECK-SA-LABEL: 'memcpy_16_al2'361; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 16, i1 false)362; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void363;364entry:365 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 16, i1 false)366 ret void367}368 369define void @memcpy_32_al2(ptr %d, ptr %s, i32 %N) {370;371; with/without strict-align:372;373; movs r2, #32374; bl __aeabi_memcpy375;376; COMMON-LABEL: 'memcpy_32_al2'377; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 32, i1 false)378; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void379;380entry:381 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 32, i1 false)382 ret void383}384 385define void @memcpy_N_al2(ptr %d, ptr %s, i32 %N) {386;387; with/without strict-align:388;389; bl __aeabi_memcpy390;391; COMMON-LABEL: 'memcpy_N_al2'392; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 %N, i1 false)393; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void394;395entry:396 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 %N, i1 false)397 ret void398}399 400;;;;;;;;;;;;;401; Align 4, 4402;;;;;;;;;;;;;403 404define void @memcpy_1_al4(ptr %d, ptr %s) {405;406; with/without strict-align:407;408; ldrb r1, [r1]409; strb r1, [r0]410;411; COMMON-LABEL: 'memcpy_1_al4'412; COMMON-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 1, i1 false)413; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void414;415entry:416 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 1, i1 false)417 ret void418}419 420define void @memcpy_2_al4(ptr %d, ptr %s) {421;422; with/without strict-align:423;424; ldrh r1, [r1]425; strh r1, [r0]426;427; COMMON-LABEL: 'memcpy_2_al4'428; COMMON-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 2, i1 false)429; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void430;431entry:432 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 2, i1 false)433 ret void434}435 436define void @memcpy_3_al4(ptr %d, ptr %s) {437;438; with/without strict-align:439;440; ldrb r2, [r1, #2]441; strb r2, [r0, #2]442; ldrh r1, [r1]443; strh r1, [r0]444;445; COMMON-LABEL: 'memcpy_3_al4'446; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 3, i1 false)447; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void448;449entry:450 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 3, i1 false)451 ret void452}453 454define void @memcpy_4_al4(ptr %d, ptr %s) {455;456; with/without strict-align:457;458; ldr r1, [r1]459; str r1, [r0]460;461; COMMON-LABEL: 'memcpy_4_al4'462; COMMON-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 4, i1 false)463; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void464;465entry:466 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 4, i1 false)467 ret void468}469 470define void @memcpy_8_al4(ptr %d, ptr %s) {471;472; with/without strict-align:473;474; ldrd r2, r1, [r1]475; strd r2, r1, [r0]476;477; COMMON-LABEL: 'memcpy_8_al4'478; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 8, i1 false)479; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void480;481entry:482 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 8, i1 false)483 ret void484}485 486define void @memcpy_16_al4(ptr %d, ptr %s) {487;488; with/without strict-align:489;490; ldm.w r1, {r2, r3, r12}491; ldr r1, [r1, #12]492; stm.w r0, {r2, r3, r12}493; str r1, [r0, #12]494;495; COMMON-LABEL: 'memcpy_16_al4'496; COMMON-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 16, i1 false)497; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void498;499entry:500 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 16, i1 false)501 ret void502}503 504define void @memcpy_32_al4(ptr %d, ptr %s, i32 %N) {505;506; with/without strict-align:507;508; ldm.w r1!, {r2, r3, r12, lr}509; stm.w r0!, {r2, r3, r12, lr}510; ldm.w r1, {r2, r3, r12, lr}511; stm.w r0, {r2, r3, r12, lr}512;513; COMMON-LABEL: 'memcpy_32_al4'514; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 32, i1 false)515; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void516;517entry:518 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 32, i1 false)519 ret void520}521 522define void @memcpy_N_al4(ptr %d, ptr %s, i32 %N) {523;524; with/without strict-align:525;526; bl __aeabi_memcpy4527;528; COMMON-LABEL: 'memcpy_N_al4'529; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 %N, i1 false)530; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void531;532entry:533 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 %N, i1 false)534 ret void535}536 537;;;;;;;;;;;;;538; Align 1, 4539;;;;;;;;;;;;;540 541define void @memcpy_1_al14(ptr %d, ptr %s) {542;543; with/without strict-align:544;545; ldrb r1, [r1]546; strb r1, [r0]547;548; COMMON-LABEL: 'memcpy_1_al14'549; COMMON-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 1, i1 false)550; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void551;552entry:553 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 1, i1 false)554 ret void555}556 557define void @memcpy_2_al14(ptr %d, ptr %s) {558;559; no strict-align:560;561; ldrh r1, [r1]562; strh r1, [r0]563;564; strict-align:565;566; ldrb r2, [r1]567; ldrb r1, [r1, #1]568; strb r1, [r0, #1]569; strb r2, [r0]570;571; CHECK-NO-SA-LABEL: 'memcpy_2_al14'572; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 2, i1 false)573; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void574;575; CHECK-SA-LABEL: 'memcpy_2_al14'576; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 2, i1 false)577; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void578;579entry:580 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 2, i1 false)581 ret void582}583 584define void @memcpy_3_al14(ptr %d, ptr %s) {585;586; no strict-align:587;588; ldrb r2, [r1, #2]589; strb r2, [r0, #2]590; ldrh r1, [r1]591; strh r1, [r0]592;593; strict-align:594;595; ldrb r2, [r1]596; ldrb r3, [r1, #1]597; ldrb r1, [r1, #2]598; strb r1, [r0, #2]599; strb r3, [r0, #1]600; strb r2, [r0]601;602; CHECK-NO-SA-LABEL: 'memcpy_3_al14'603; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 3, i1 false)604; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void605;606; CHECK-SA-LABEL: 'memcpy_3_al14'607; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 6 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 3, i1 false)608; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void609;610entry:611 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 3, i1 false)612 ret void613}614 615define void @memcpy_4_al14(ptr %d, ptr %s) {616;617; no strict-align:618;619; ldr r1, [r1]620; str r1, [r0]621;622; strict-align:623;624; ldrb.w r12, [r1]625; ldrb r3, [r1, #1]626; ldrb r2, [r1, #2]627; ldrb r1, [r1, #3]628; strb r1, [r0, #3]629; strb r2, [r0, #2]630; strb r3, [r0, #1]631; strb.w r12, [r0]632;633; CHECK-NO-SA-LABEL: 'memcpy_4_al14'634; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 4, i1 false)635; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void636;637; CHECK-SA-LABEL: 'memcpy_4_al14'638; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 4, i1 false)639; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void640;641entry:642 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 4, i1 false)643 ret void644}645 646define void @memcpy_8_al14(ptr %d, ptr %s) {647;648; no strict-align:649;650; ldr r2, [r1]651; ldr r1, [r1, #4]652; str r1, [r0, #4]653; str r2, [r0]654;655; strict-align:656;657; push {r7, lr}658; movs r2, #8659; bl __aeabi_memcpy660; pop {r7, pc}661;662; COMMON-LABEL: 'memcpy_8_al14'663; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 8, i1 false)664; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void665;666entry:667 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 8, i1 false)668 ret void669}670 671define void @memcpy_16_al14(ptr %d, ptr %s) {672;673; no strict-align:674;675; ldr.w r12, [r1]676; ldr r3, [r1, #4]677; ldr r2, [r1, #8]678; ldr r1, [r1, #12]679; str r1, [r0, #12]680; str r2, [r0, #8]681; str r3, [r0, #4]682; str.w r12, [r0]683;684; strict-align:685;686; movs r2, #16687; bl __aeabi_memcpy688;689; CHECK-NO-SA-LABEL: 'memcpy_16_al14'690; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 16, i1 false)691; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void692;693; CHECK-SA-LABEL: 'memcpy_16_al14'694; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 16, i1 false)695; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void696;697entry:698 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 16, i1 false)699 ret void700}701 702define void @memcpy_32_al14(ptr %d, ptr %s) {703;704; with/without strict-align:705;706; movs r2, #32707; bl __aeabi_memcpy708;709; COMMON-LABEL: 'memcpy_32_al14'710; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 32, i1 false)711; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void712;713entry:714 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 32, i1 false)715 ret void716}717 718define void @memcpy_N_al14(ptr %d, ptr %s, i32 %N) {719;720; with/without strict-align:721;722; bl __aeabi_memcpy4723;724; COMMON-LABEL: 'memcpy_N_al14'725; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 %N, i1 false)726; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void727;728entry:729 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 %N, i1 false)730 ret void731}732 733;;;;;;;;;;;;;734; Align 4, 1735;;;;;;;;;;;;;736 737define void @memcpy_1_al41(ptr %d, ptr %s) {738;739; with/without strict-align:740;741; ldrb r1, [r1]742; strb r1, [r0]743;744; COMMON-LABEL: 'memcpy_1_al41'745; COMMON-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 1 %s, i32 1, i1 false)746; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void747;748entry:749 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 1 %s, i32 1, i1 false)750 ret void751}752 753declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i1) #1754