1 ; RUN: opt < %s -cost-model -analyze -mtriple=armv7-linux-gnueabihf -mcpu=cortex-a9 | FileCheck --check-prefix=COST %s
2 ; To see the assembly output: llc -mcpu=cortex-a9 < %s | FileCheck --check-prefix=ASM %s
3 ; ASM lines below are only for reference, tests on that direction should go to tests/CodeGen/ARM
6 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"
7 target triple = "armv7--linux-gnueabihf"
10 %T232 = type <2 x i32>
11 %T264 = type <2 x i64>
13 %T416 = type <4 x i16>
14 %T432 = type <4 x i32>
15 %T464 = type <4 x i64>
17 define void @direct(%T432* %loadaddr, %T432* %loadaddr2, %T432* %storeaddr) {
18 ; COST: function 'direct':
19 %v0 = load %T432, %T432* %loadaddr
21 %v1 = load %T432, %T432* %loadaddr2
23 %r3 = mul %T432 %v0, %v1
24 ; COST: cost of 2 for instruction: {{.*}} mul <4 x i32>
26 store %T432 %r3, %T432* %storeaddr
31 define void @ups1632(%T416* %loadaddr, %T416* %loadaddr2, %T432* %storeaddr) {
32 ; COST: function 'ups1632':
33 %v0 = load %T416, %T416* %loadaddr
35 %v1 = load %T416, %T416* %loadaddr2
37 %r1 = sext %T416 %v0 to %T432
38 %r2 = sext %T416 %v1 to %T432
39 ; COST: cost of 0 for instruction: {{.*}} sext <4 x i16> {{.*}} to <4 x i32>
40 %r3 = mul %T432 %r1, %r2
41 ; COST: cost of 2 for instruction: {{.*}} mul <4 x i32>
43 store %T432 %r3, %T432* %storeaddr
48 define void @upu1632(%T416* %loadaddr, %T416* %loadaddr2, %T432* %storeaddr) {
49 ; COST: function 'upu1632':
50 %v0 = load %T416, %T416* %loadaddr
52 %v1 = load %T416, %T416* %loadaddr2
54 %r1 = zext %T416 %v0 to %T432
55 %r2 = zext %T416 %v1 to %T432
56 ; COST: cost of 0 for instruction: {{.*}} zext <4 x i16> {{.*}} to <4 x i32>
57 %r3 = mul %T432 %r1, %r2
58 ; COST: cost of 2 for instruction: {{.*}} mul <4 x i32>
60 store %T432 %r3, %T432* %storeaddr
65 define void @ups3264(%T232* %loadaddr, %T232* %loadaddr2, %T264* %storeaddr) {
66 ; COST: function 'ups3264':
67 %v0 = load %T232, %T232* %loadaddr
69 %v1 = load %T232, %T232* %loadaddr2
71 %r3 = mul %T232 %v0, %v1
73 ; COST: cost of 1 for instruction: {{.*}} mul <2 x i32>
74 %st = sext %T232 %r3 to %T264
76 ; COST: cost of 1 for instruction: {{.*}} sext <2 x i32> {{.*}} to <2 x i64>
77 store %T264 %st, %T264* %storeaddr
82 define void @upu3264(%T232* %loadaddr, %T232* %loadaddr2, %T264* %storeaddr) {
83 ; COST: function 'upu3264':
84 %v0 = load %T232, %T232* %loadaddr
86 %v1 = load %T232, %T232* %loadaddr2
88 %r3 = mul %T232 %v0, %v1
90 ; COST: cost of 1 for instruction: {{.*}} mul <2 x i32>
91 %st = zext %T232 %r3 to %T264
93 ; COST: cost of 1 for instruction: {{.*}} zext <2 x i32> {{.*}} to <2 x i64>
94 store %T264 %st, %T264* %storeaddr
99 define void @dn3216(%T432* %loadaddr, %T432* %loadaddr2, %T416* %storeaddr) {
100 ; COST: function 'dn3216':
101 %v0 = load %T432, %T432* %loadaddr
103 %v1 = load %T432, %T432* %loadaddr2
105 %r3 = mul %T432 %v0, %v1
107 ; COST: cost of 2 for instruction: {{.*}} mul <4 x i32>
108 %st = trunc %T432 %r3 to %T416
110 ; COST: cost of 1 for instruction: {{.*}} trunc <4 x i32> {{.*}} to <4 x i16>
111 store %T416 %st, %T416* %storeaddr