1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=armv7-linux-gnueabihf -mcpu=cortex-a9 | FileCheck --check-prefix=COST %s
3 ; To see the assembly output: llc -mcpu=cortex-a9 < %s | FileCheck --check-prefix=ASM %s
4 ; ASM lines below are only for reference, tests on that direction should go to tests/CodeGen/ARM
7 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S64"
8 target triple = "armv7--linux-gnueabihf"
10 %T216 = type <2 x i16>
11 %T232 = type <2 x i32>
12 %T264 = type <2 x i64>
14 %T416 = type <4 x i16>
15 %T432 = type <4 x i32>
16 %T464 = type <4 x i64>
18 define void @direct(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
19 ; COST-LABEL: 'direct'
20 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v0 = load <4 x i32>, ptr %loadaddr, align 8
21 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v1 = load <4 x i32>, ptr %loadaddr2, align 8
22 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r3 = mul <4 x i32> %v0, %v1
23 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i32> %r3, ptr %storeaddr, align 8
24 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
26 %v0 = load %T432, ptr %loadaddr
28 %v1 = load %T432, ptr %loadaddr2
30 %r3 = mul %T432 %v0, %v1
32 store %T432 %r3, ptr %storeaddr
37 define void @ups1632(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
38 ; COST-LABEL: 'ups1632'
39 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v0 = load <4 x i16>, ptr %loadaddr, align 8
40 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v1 = load <4 x i16>, ptr %loadaddr2, align 8
41 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r1 = sext <4 x i16> %v0 to <4 x i32>
42 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r2 = sext <4 x i16> %v1 to <4 x i32>
43 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r3 = mul <4 x i32> %r1, %r2
44 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i32> %r3, ptr %storeaddr, align 8
45 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
47 %v0 = load %T416, ptr %loadaddr
49 %v1 = load %T416, ptr %loadaddr2
51 %r1 = sext %T416 %v0 to %T432
52 %r2 = sext %T416 %v1 to %T432
53 %r3 = mul %T432 %r1, %r2
55 store %T432 %r3, ptr %storeaddr
60 define void @upu1632(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
61 ; COST-LABEL: 'upu1632'
62 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v0 = load <4 x i16>, ptr %loadaddr, align 8
63 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v1 = load <4 x i16>, ptr %loadaddr2, align 8
64 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r1 = zext <4 x i16> %v0 to <4 x i32>
65 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r2 = zext <4 x i16> %v1 to <4 x i32>
66 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r3 = mul <4 x i32> %r1, %r2
67 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i32> %r3, ptr %storeaddr, align 8
68 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
70 %v0 = load %T416, ptr %loadaddr
72 %v1 = load %T416, ptr %loadaddr2
74 %r1 = zext %T416 %v0 to %T432
75 %r2 = zext %T416 %v1 to %T432
76 %r3 = mul %T432 %r1, %r2
78 store %T432 %r3, ptr %storeaddr
83 define void @ups3264(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
84 ; COST-LABEL: 'ups3264'
85 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v0 = load <2 x i32>, ptr %loadaddr, align 8
86 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v1 = load <2 x i32>, ptr %loadaddr2, align 8
87 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r3 = mul <2 x i32> %v0, %v1
88 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %st = sext <2 x i32> %r3 to <2 x i64>
89 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <2 x i64> %st, ptr %storeaddr, align 8
90 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
92 %v0 = load %T232, ptr %loadaddr
94 %v1 = load %T232, ptr %loadaddr2
96 %r3 = mul %T232 %v0, %v1
98 %st = sext %T232 %r3 to %T264
100 store %T264 %st, ptr %storeaddr
105 define void @upu3264(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
106 ; COST-LABEL: 'upu3264'
107 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v0 = load <2 x i32>, ptr %loadaddr, align 8
108 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v1 = load <2 x i32>, ptr %loadaddr2, align 8
109 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r3 = mul <2 x i32> %v0, %v1
110 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %st = zext <2 x i32> %r3 to <2 x i64>
111 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <2 x i64> %st, ptr %storeaddr, align 8
112 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
114 %v0 = load %T232, ptr %loadaddr
116 %v1 = load %T232, ptr %loadaddr2
118 %r3 = mul %T232 %v0, %v1
120 %st = zext %T232 %r3 to %T264
122 store %T264 %st, ptr %storeaddr
127 define void @dn3216(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
128 ; COST-LABEL: 'dn3216'
129 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v0 = load <4 x i32>, ptr %loadaddr, align 8
130 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v1 = load <4 x i32>, ptr %loadaddr2, align 8
131 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r3 = mul <4 x i32> %v0, %v1
132 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %st = trunc <4 x i32> %r3 to <4 x i16>
133 ; COST-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <4 x i16> %st, ptr %storeaddr, align 8
134 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
136 %v0 = load %T432, ptr %loadaddr
138 %v1 = load %T432, ptr %loadaddr2
140 %r3 = mul %T432 %v0, %v1
142 %st = trunc %T432 %r3 to %T416
144 store %T416 %st, ptr %storeaddr