Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

754 lines
22 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size | \
; RUN: FileCheck %s --check-prefixes=COMMON,CHECK-NO-SA
; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+strict-align | \
; RUN: FileCheck %s --check-prefixes=COMMON,CHECK-SA
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "thumbv7m-arm-unknown-eabi"
;;;;;;;;;;;;
; Align 1, 1
;;;;;;;;;;;;
define void @memcpy_0(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrb r1, [r1]
; strb r1, [r0]
;
; COMMON-LABEL: 'memcpy_0'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr %d, ptr %s, i32 1, i1 false)
ret void
}
define void @memcpy_1(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrb r1, [r1]
; strb r1, [r0]
;
; COMMON-LABEL: 'memcpy_1'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 1, i1 false)
ret void
}
define void @memcpy_2(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldrh r1, [r1]
; strh r1, [r0]
;
; strict-align:
;
; ldrb r2, [r1]
; ldrb r1, [r1, #1]
; strb r1, [r0, #1]
; strb r2, [r0]
;
; CHECK-NO-SA-LABEL: 'memcpy_2'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_2'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 2, i1 false)
ret void
}
define void @memcpy_3(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldrb r2, [r1, #2]
; strb r2, [r0, #2]
; ldrh r1, [r1]
; strh r1, [r0]
;
; strict-align:
;
; ldrb r2, [r1]
; ldrb r3, [r1, #1]
; ldrb r1, [r1, #2]
; strb r1, [r0, #2]
; strb r3, [r0, #1]
; strb r2, [r0]
;
; CHECK-NO-SA-LABEL: 'memcpy_3'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_3'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 3, i1 false)
ret void
}
define void @memcpy_4(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldr r1, [r1]
; str r1, [r0]
;
; strict-align:
;
; ldrb.w r12, [r1]
; ldrb r3, [r1, #1]
; ldrb r2, [r1, #2]
; ldrb r1, [r1, #3]
; strb r1, [r0, #3]
; strb r2, [r0, #2]
; strb r3, [r0, #1]
; strb.w r12, [r0]
;
; CHECK-NO-SA-LABEL: 'memcpy_4'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_4'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 4, i1 false)
ret void
}
define void @memcpy_8(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldr r2, [r1]
; ldr r1, [r1, #4]
; str r1, [r0, #4]
; str r2, [r0]
;
; strict-align:
;
; push {r7, lr}
; movs r2, #8
; bl __aeabi_memcpy
; pop {r7, pc}
;
; COMMON-LABEL: 'memcpy_8'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 8, i1 false)
ret void
}
define void @memcpy_16(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldr.w r12, [r1]
; ldr r3, [r1, #4]
; ldr r2, [r1, #8]
; ldr r1, [r1, #12]
; str r1, [r0, #12]
; str r2, [r0, #8]
; str r3, [r0, #4]
; str.w r12, [r0]
;
; strict-align:
;
; push {r7, lr}
; movs r2, #8
; bl __aeabi_memcpy
; pop {r7, pc}
;
; CHECK-NO-SA-LABEL: 'memcpy_16'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_16'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 16, i1 false)
ret void
}
define void @memcpy_32(ptr %d, ptr %s, i32 %N) {
;
; with/without strict-align:
;
; movs r2, #32
; bl __aeabi_memcpy
;
; COMMON-LABEL: 'memcpy_32'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 32, i1 false)
ret void
}
define void @memcpy_N(ptr %d, ptr %s, i32 %N) {
;
; with/without strict-align:
;
; bl __aeabi_memcpy
;
; COMMON-LABEL: 'memcpy_N'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 1 %s, i32 %N, i1 false)
ret void
}
;;;;;;;;;;;;;
; Align 2, 2
;;;;;;;;;;;;;
define void @memcpy_1_al2(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrb r1, [r1]
; strb r1, [r0]
;
; COMMON-LABEL: 'memcpy_1_al2'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 1, i1 false)
ret void
}
define void @memcpy_2_al2(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrh r1, [r1]
; strh r1, [r0]
;
; COMMON-LABEL: 'memcpy_2_al2'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 2, i1 false)
ret void
}
define void @memcpy_3_al2(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrb r2, [r1, #2]
; strb r2, [r0, #2]
; ldrh r1, [r1]
; strh r1, [r0]
;
; COMMON-LABEL: 'memcpy_3_al2'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 3, i1 false)
ret void
}
define void @memcpy_4_al2(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldr r1, [r1]
; str r1, [r0]
;
; strict-align:
;
; ldrh r2, [r1, #2]
; strh r2, [r0, #2]
; ldrh r1, [r1]
; strh r1, [r0]
;
; CHECK-NO-SA-LABEL: 'memcpy_4_al2'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_4_al2'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 4, i1 false)
ret void
}
define void @memcpy_8_al2(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldr r2, [r1]
; ldr r1, [r1, #4]
; str r1, [r0, #4]
; str r2, [r0]
;
; strict-align:
;
; ldrh r2, [r1, #6]
; strh r2, [r0, #6]
; ldrh r2, [r1, #4]
; strh r2, [r0, #4]
; ldrh r2, [r1, #2]
; strh r2, [r0, #2]
; ldrh r1, [r1]
; strh r1, [r0]
;
; CHECK-NO-SA-LABEL: 'memcpy_8_al2'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_8_al2'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 8, i1 false)
ret void
}
define void @memcpy_16_al2(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldr.w r12, [r1]
; ldr r3, [r1, #4]
; ldr r2, [r1, #8]
; ldr r1, [r1, #12]
; str r1, [r0, #12]
; str r2, [r0, #8]
; str r3, [r0, #4]
; str.w r12, [r0]
;
; strict-align:
;
; movs r2, #16
; bl __aeabi_memcpy
;
; CHECK-NO-SA-LABEL: 'memcpy_16_al2'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_16_al2'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 16, i1 false)
ret void
}
define void @memcpy_32_al2(ptr %d, ptr %s, i32 %N) {
;
; with/without strict-align:
;
; movs r2, #32
; bl __aeabi_memcpy
;
; COMMON-LABEL: 'memcpy_32_al2'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 32, i1 false)
ret void
}
define void @memcpy_N_al2(ptr %d, ptr %s, i32 %N) {
;
; with/without strict-align:
;
; bl __aeabi_memcpy
;
; COMMON-LABEL: 'memcpy_N_al2'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 2 %d, ptr align 2 %s, i32 %N, i1 false)
ret void
}
;;;;;;;;;;;;;
; Align 4, 4
;;;;;;;;;;;;;
define void @memcpy_1_al4(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrb r1, [r1]
; strb r1, [r0]
;
; COMMON-LABEL: 'memcpy_1_al4'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 1, i1 false)
ret void
}
define void @memcpy_2_al4(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrh r1, [r1]
; strh r1, [r0]
;
; COMMON-LABEL: 'memcpy_2_al4'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 2, i1 false)
ret void
}
define void @memcpy_3_al4(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrb r2, [r1, #2]
; strb r2, [r0, #2]
; ldrh r1, [r1]
; strh r1, [r0]
;
; COMMON-LABEL: 'memcpy_3_al4'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 3, i1 false)
ret void
}
define void @memcpy_4_al4(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldr r1, [r1]
; str r1, [r0]
;
; COMMON-LABEL: 'memcpy_4_al4'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 4, i1 false)
ret void
}
define void @memcpy_8_al4(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrd r2, r1, [r1]
; strd r2, r1, [r0]
;
; COMMON-LABEL: 'memcpy_8_al4'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 8, i1 false)
ret void
}
define void @memcpy_16_al4(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldm.w r1, {r2, r3, r12}
; ldr r1, [r1, #12]
; stm.w r0, {r2, r3, r12}
; str r1, [r0, #12]
;
; COMMON-LABEL: 'memcpy_16_al4'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 16, i1 false)
ret void
}
define void @memcpy_32_al4(ptr %d, ptr %s, i32 %N) {
;
; with/without strict-align:
;
; ldm.w r1!, {r2, r3, r12, lr}
; stm.w r0!, {r2, r3, r12, lr}
; ldm.w r1, {r2, r3, r12, lr}
; stm.w r0, {r2, r3, r12, lr}
;
; COMMON-LABEL: 'memcpy_32_al4'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 32, i1 false)
ret void
}
define void @memcpy_N_al4(ptr %d, ptr %s, i32 %N) {
;
; with/without strict-align:
;
; bl __aeabi_memcpy4
;
; COMMON-LABEL: 'memcpy_N_al4'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 4 %s, i32 %N, i1 false)
ret void
}
;;;;;;;;;;;;;
; Align 1, 4
;;;;;;;;;;;;;
define void @memcpy_1_al14(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrb r1, [r1]
; strb r1, [r0]
;
; COMMON-LABEL: 'memcpy_1_al14'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 1, i1 false)
ret void
}
define void @memcpy_2_al14(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldrh r1, [r1]
; strh r1, [r0]
;
; strict-align:
;
; ldrb r2, [r1]
; ldrb r1, [r1, #1]
; strb r1, [r0, #1]
; strb r2, [r0]
;
; CHECK-NO-SA-LABEL: 'memcpy_2_al14'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_2_al14'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 2, i1 false)
ret void
}
define void @memcpy_3_al14(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldrb r2, [r1, #2]
; strb r2, [r0, #2]
; ldrh r1, [r1]
; strh r1, [r0]
;
; strict-align:
;
; ldrb r2, [r1]
; ldrb r3, [r1, #1]
; ldrb r1, [r1, #2]
; strb r1, [r0, #2]
; strb r3, [r0, #1]
; strb r2, [r0]
;
; CHECK-NO-SA-LABEL: 'memcpy_3_al14'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_3_al14'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 3, i1 false)
ret void
}
define void @memcpy_4_al14(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldr r1, [r1]
; str r1, [r0]
;
; strict-align:
;
; ldrb.w r12, [r1]
; ldrb r3, [r1, #1]
; ldrb r2, [r1, #2]
; ldrb r1, [r1, #3]
; strb r1, [r0, #3]
; strb r2, [r0, #2]
; strb r3, [r0, #1]
; strb.w r12, [r0]
;
; CHECK-NO-SA-LABEL: 'memcpy_4_al14'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_4_al14'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 4, i1 false)
ret void
}
define void @memcpy_8_al14(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldr r2, [r1]
; ldr r1, [r1, #4]
; str r1, [r0, #4]
; str r2, [r0]
;
; strict-align:
;
; push {r7, lr}
; movs r2, #8
; bl __aeabi_memcpy
; pop {r7, pc}
;
; COMMON-LABEL: 'memcpy_8_al14'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 8, i1 false)
ret void
}
define void @memcpy_16_al14(ptr %d, ptr %s) {
;
; no strict-align:
;
; ldr.w r12, [r1]
; ldr r3, [r1, #4]
; ldr r2, [r1, #8]
; ldr r1, [r1, #12]
; str r1, [r0, #12]
; str r2, [r0, #8]
; str r3, [r0, #4]
; str.w r12, [r0]
;
; strict-align:
;
; movs r2, #16
; bl __aeabi_memcpy
;
; CHECK-NO-SA-LABEL: 'memcpy_16_al14'
; 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)
; CHECK-NO-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
; CHECK-SA-LABEL: 'memcpy_16_al14'
; 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)
; CHECK-SA-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 16, i1 false)
ret void
}
define void @memcpy_32_al14(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; movs r2, #32
; bl __aeabi_memcpy
;
; COMMON-LABEL: 'memcpy_32_al14'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 32, i1 false)
ret void
}
define void @memcpy_N_al14(ptr %d, ptr %s, i32 %N) {
;
; with/without strict-align:
;
; bl __aeabi_memcpy4
;
; COMMON-LABEL: 'memcpy_N_al14'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %d, ptr align 4 %s, i32 %N, i1 false)
ret void
}
;;;;;;;;;;;;;
; Align 4, 1
;;;;;;;;;;;;;
define void @memcpy_1_al41(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrb r1, [r1]
; strb r1, [r0]
;
; COMMON-LABEL: 'memcpy_1_al41'
; 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)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %d, ptr align 1 %s, i32 1, i1 false)
ret void
}
declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i1) #1