• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -cost-model -analyze | FileCheck %s
2
3; The cost model does not have any target information so it just makes boring
4; assumptions.
5
6; -- No triple in this module --
7
8; CHECK-LABEL: function 'no_info'
9; CHECK: cost of 1 {{.*}} add
10; CHECK: cost of 1 {{.*}} ret
11define i32 @no_info(i32 %arg) {
12  %e = add i32 %arg, %arg
13  ret i32 %e
14}
15
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}
32