1 ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -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(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
18 ; COST: function 'direct'
19 %v0 = load %T432, ptr %loadaddr
21 %v1 = load %T432, ptr %loadaddr2
23 %r3 = add %T432 %v0, %v1
24 ; COST: cost of 1 for instruction: {{.*}} add <4 x i32>
26 store %T432 %r3, ptr %storeaddr
31 define void @ups1632(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
32 ; COST: function 'ups1632'
33 %v0 = load %T416, ptr %loadaddr
35 %v1 = load %T416, ptr %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 = add %T432 %r1, %r2
41 ; COST: cost of 1 for instruction: {{.*}} add <4 x i32>
43 store %T432 %r3, ptr %storeaddr
48 define void @upu1632(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
49 ; COST: function 'upu1632'
50 %v0 = load %T416, ptr %loadaddr
52 %v1 = load %T416, ptr %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 = add %T432 %r1, %r2
58 ; COST: cost of 1 for instruction: {{.*}} add <4 x i32>
60 store %T432 %r3, ptr %storeaddr
65 define void @ups3264(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
66 ; COST: function 'ups3264'
67 %v0 = load %T232, ptr %loadaddr
69 %v1 = load %T232, ptr %loadaddr2
71 %r3 = add %T232 %v0, %v1
73 ; COST: cost of 1 for instruction: {{.*}} add <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, ptr %storeaddr
82 define void @upu3264(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
83 ; COST: function 'upu3264'
84 %v0 = load %T232, ptr %loadaddr
86 %v1 = load %T232, ptr %loadaddr2
88 %r3 = add %T232 %v0, %v1
90 ; COST: cost of 1 for instruction: {{.*}} add <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, ptr %storeaddr
99 define void @dn3216(ptr %loadaddr, ptr %loadaddr2, ptr %storeaddr) {
100 ; COST: function 'dn3216'
101 %v0 = load %T432, ptr %loadaddr
103 %v1 = load %T432, ptr %loadaddr2
105 %r3 = add %T432 %v0, %v1
107 ; COST: cost of 1 for instruction: {{.*}} add <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, ptr %storeaddr