ARM cost model: Add vector reverse shuffle costs
[oota-llvm.git] / test / Analysis / CostModel / ARM / cast.ll
1 ; RUN: opt < %s  -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift | FileCheck %s
2 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
3 target triple = "thumbv7-apple-ios6.0.0"
4
5 define i32 @casts() {
6
7     ; -- scalars --
8   ; CHECK: cost of 1 {{.*}} sext
9   %r0 = sext i1 undef to i8
10   ; CHECK: cost of 1 {{.*}} zext
11   %r1 = zext i1 undef to i8
12   ; CHECK: cost of 1 {{.*}} sext
13   %r2 = sext i1 undef to i16
14   ; CHECK: cost of 1 {{.*}} zext
15   %r3 = zext i1 undef to i16
16   ; CHECK: cost of 1 {{.*}} sext
17   %r4 = sext i1 undef to i32
18   ; CHECK: cost of 1 {{.*}} zext
19   %r5 = zext i1 undef to i32
20   ; CHECK: cost of 1 {{.*}} sext
21   %r6 = sext i1 undef to i64
22   ; CHECK: cost of 1 {{.*}} zext
23   %r7 = zext i1 undef to i64
24   ; CHECK: cost of 0 {{.*}} trunc
25   %r8 = trunc i8 undef to i1
26   ; CHECK: cost of 1 {{.*}} sext
27   %r9 = sext i8 undef to i16
28   ; CHECK: cost of 1 {{.*}} zext
29   %r10 = zext i8 undef to i16
30   ; CHECK: cost of 1 {{.*}} sext
31   %r11 = sext i8 undef to i32
32   ; CHECK: cost of 1 {{.*}} zext
33   %r12 = zext i8 undef to i32
34   ; CHECK: cost of 1 {{.*}} sext
35   %r13 = sext i8 undef to i64
36   ; CHECK: cost of 1 {{.*}} zext
37   %r14 = zext i8 undef to i64
38   ; CHECK: cost of 0 {{.*}} trunc
39   %r15 = trunc i16 undef to i1
40   ; CHECK: cost of 0 {{.*}} trunc
41   %r16 = trunc i16 undef to i8
42   ; CHECK: cost of 1 {{.*}} sext
43   %r17 = sext i16 undef to i32
44   ; CHECK: cost of 1 {{.*}} zext
45   %r18 = zext i16 undef to i32
46   ; CHECK: cost of 2 {{.*}} sext
47   %r19 = sext i16 undef to i64
48   ; CHECK: cost of 1 {{.*}} zext
49   %r20 = zext i16 undef to i64
50   ; CHECK: cost of 0 {{.*}} trunc
51   %r21 = trunc i32 undef to i1
52   ; CHECK: cost of 0 {{.*}} trunc
53   %r22 = trunc i32 undef to i8
54   ; CHECK: cost of 0 {{.*}} trunc
55   %r23 = trunc i32 undef to i16
56   ; CHECK: cost of 1 {{.*}} sext
57   %r24 = sext i32 undef to i64
58   ; CHECK: cost of 1 {{.*}} zext
59   %r25 = zext i32 undef to i64
60   ; CHECK: cost of 0 {{.*}} trunc
61   %r26 = trunc i64 undef to i1
62   ; CHECK: cost of 0 {{.*}} trunc
63   %r27 = trunc i64 undef to i8
64   ; CHECK: cost of 0 {{.*}} trunc
65   %r28 = trunc i64 undef to i16
66   ; CHECK: cost of 0 {{.*}} trunc
67   %r29 = trunc i64 undef to i32
68
69     ; -- floating point conversions --
70   ; Moves between scalar and NEON registers.
71   ; CHECK: cost of 2 {{.*}} fptoui
72   %r30 = fptoui float undef to i1
73   ; CHECK: cost of 2 {{.*}} fptosi
74   %r31 = fptosi float undef to i1
75   ; CHECK: cost of 2 {{.*}} fptoui
76   %r32 = fptoui float undef to i8
77   ; CHECK: cost of 2 {{.*}} fptosi
78   %r33 = fptosi float undef to i8
79   ; CHECK: cost of 2 {{.*}} fptoui
80   %r34 = fptoui float undef to i16
81   ; CHECK: cost of 2 {{.*}} fptosi
82   %r35 = fptosi float undef to i16
83   ; CHECK: cost of 2 {{.*}} fptoui
84   %r36 = fptoui float undef to i32
85   ; CHECK: cost of 2 {{.*}} fptosi
86   %r37 = fptosi float undef to i32
87   ; CHECK: cost of 10 {{.*}} fptoui
88   %r38 = fptoui float undef to i64
89   ; CHECK: cost of 10 {{.*}} fptosi
90   %r39 = fptosi float undef to i64
91   ; CHECK: cost of 2 {{.*}} fptoui
92   %r40 = fptoui double undef to i1
93   ; CHECK: cost of 2 {{.*}} fptosi
94   %r41 = fptosi double undef to i1
95   ; CHECK: cost of 2 {{.*}} fptoui
96   %r42 = fptoui double undef to i8
97   ; CHECK: cost of 2 {{.*}} fptosi
98   %r43 = fptosi double undef to i8
99   ; CHECK: cost of 2 {{.*}} fptoui
100   %r44 = fptoui double undef to i16
101   ; CHECK: cost of 2 {{.*}} fptosi
102   %r45 = fptosi double undef to i16
103   ; CHECK: cost of 2 {{.*}} fptoui
104   %r46 = fptoui double undef to i32
105   ; CHECK: cost of 2 {{.*}} fptosi
106   %r47 = fptosi double undef to i32
107   ; Function call
108   ; CHECK: cost of 10 {{.*}} fptoui
109   %r48 = fptoui double undef to i64
110   ; CHECK: cost of 10 {{.*}} fptosi
111   %r49 = fptosi double undef to i64
112
113   ; CHECK: cost of 2 {{.*}} sitofp
114   %r50 = sitofp i1 undef to float
115   ; CHECK: cost of 2 {{.*}} uitofp
116   %r51 = uitofp i1 undef to float
117   ; CHECK: cost of 2 {{.*}} sitofp
118   %r52 = sitofp i1 undef to double
119   ; CHECK: cost of 2 {{.*}} uitofp
120   %r53 = uitofp i1 undef to double
121   ; CHECK: cost of 2 {{.*}} sitofp
122   %r54 = sitofp i8 undef to float
123   ; CHECK: cost of 2 {{.*}} uitofp
124   %r55 = uitofp i8 undef to float
125   ; CHECK: cost of 2 {{.*}} sitofp
126   %r56 = sitofp i8 undef to double
127   ; CHECK: cost of 2 {{.*}} uitofp
128   %r57 = uitofp i8 undef to double
129   ; CHECK: cost of 2 {{.*}} sitofp
130   %r58 = sitofp i16 undef to float
131   ; CHECK: cost of 2 {{.*}} uitofp
132   %r59 = uitofp i16 undef to float
133   ; CHECK: cost of 2 {{.*}} sitofp
134   %r60 = sitofp i16 undef to double
135   ; CHECK: cost of 2 {{.*}} uitofp
136   %r61 = uitofp i16 undef to double
137   ; CHECK: cost of 2 {{.*}} sitofp
138   %r62 = sitofp i32 undef to float
139   ; CHECK: cost of 2 {{.*}} uitofp
140   %r63 = uitofp i32 undef to float
141   ; CHECK: cost of 2 {{.*}} sitofp
142   %r64 = sitofp i32 undef to double
143   ; CHECK: cost of 2 {{.*}} uitofp
144   %r65 = uitofp i32 undef to double
145   ; Function call
146   ; CHECK: cost of 10 {{.*}} sitofp
147   %r66 = sitofp i64 undef to float
148   ; CHECK: cost of 10 {{.*}} uitofp
149   %r67 = uitofp i64 undef to float
150   ; CHECK: cost of 10 {{.*}} sitofp
151   %r68 = sitofp i64 undef to double
152   ; CHECK: cost of 10 {{.*}} uitofp
153   %r69 = uitofp i64 undef to double
154
155   ;CHECK: cost of 0 {{.*}} ret
156   ret i32 undef
157 }
158