blob: 931669b6017689b89895ec7539a734223557e686 [file] [log] [blame]
Nadav Rotema6b91ac2012-11-02 21:48:17 +00001; RUN: opt < %s -cost-model -analyze | FileCheck %s
2
Chandler Carruth705b1852015-01-31 03:43:40 +00003; The cost model does not have any target information so it just makes boring
4; assumptions.
Nadav Rotema6b91ac2012-11-02 21:48:17 +00005
Nadav Rotemb1615b12013-01-01 08:00:32 +00006; -- No triple in this module --
Nadav Rotema6b91ac2012-11-02 21:48:17 +00007
Jingyue Wubfefff52015-07-26 19:10:03 +00008; CHECK-LABEL: function 'no_info'
9; CHECK: cost of 1 {{.*}} add
10; CHECK: cost of 1 {{.*}} ret
Nadav Rotema6b91ac2012-11-02 21:48:17 +000011define i32 @no_info(i32 %arg) {
12 %e = add i32 %arg, %arg
13 ret i32 %e
14}
Jingyue Wubfefff52015-07-26 19:10:03 +000015
16define i8 @addressing_mode_reg_reg(i8* %a, i32 %b) {
17; CHECK-LABEL: function 'addressing_mode_reg_reg'
18 %p = getelementptr i8, i8* %a, i32 %b ; NoTTI accepts reg+reg addressing.
19; CHECK: cost of 0 {{.*}} getelementptr
20 %v = load i8, i8* %p
21 ret i8 %v
22}
23
24; CHECK-LABEL: function 'addressing_mode_scaled_reg'
25define i32 @addressing_mode_scaled_reg(i32* %a, i32 %b) {
26 ; NoTTI rejects reg+scale*reg addressing.
27 %p = getelementptr i32, i32* %a, i32 %b
28; CHECK: cost of 1 {{.*}} getelementptr
29 %v = load i32, i32* %p
30 ret i32 %v
31}