xref: /aosp_15_r20/external/llvm/test/Analysis/CostModel/no_info.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -cost-model -analyze | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; The cost model does not have any target information so it just makes boring
4*9880d681SAndroid Build Coastguard Worker; assumptions.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; -- No triple in this module --
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: function 'no_info'
9*9880d681SAndroid Build Coastguard Worker; CHECK: cost of 1 {{.*}} add
10*9880d681SAndroid Build Coastguard Worker; CHECK: cost of 1 {{.*}} ret
11*9880d681SAndroid Build Coastguard Workerdefine i32 @no_info(i32 %arg) {
12*9880d681SAndroid Build Coastguard Worker  %e = add i32 %arg, %arg
13*9880d681SAndroid Build Coastguard Worker  ret i32 %e
14*9880d681SAndroid Build Coastguard Worker}
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerdefine i8 @addressing_mode_reg_reg(i8* %a, i32 %b) {
17*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: function 'addressing_mode_reg_reg'
18*9880d681SAndroid Build Coastguard Worker  %p = getelementptr i8, i8* %a, i32 %b ; NoTTI accepts reg+reg addressing.
19*9880d681SAndroid Build Coastguard Worker; CHECK: cost of 0 {{.*}} getelementptr
20*9880d681SAndroid Build Coastguard Worker  %v = load i8, i8* %p
21*9880d681SAndroid Build Coastguard Worker  ret i8 %v
22*9880d681SAndroid Build Coastguard Worker}
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: function 'addressing_mode_scaled_reg'
25*9880d681SAndroid Build Coastguard Workerdefine i32 @addressing_mode_scaled_reg(i32* %a, i32 %b) {
26*9880d681SAndroid Build Coastguard Worker  ; NoTTI rejects reg+scale*reg addressing.
27*9880d681SAndroid Build Coastguard Worker  %p = getelementptr i32, i32* %a, i32 %b
28*9880d681SAndroid Build Coastguard Worker; CHECK: cost of 1 {{.*}} getelementptr
29*9880d681SAndroid Build Coastguard Worker  %v = load i32, i32* %p
30*9880d681SAndroid Build Coastguard Worker  ret i32 %v
31*9880d681SAndroid Build Coastguard Worker}
32