Arnold Schwaighofer | 594fa2d | 2013-02-08 14:50:48 +0000 | [diff] [blame^] | 1 | ; RUN: opt -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift < %s | FileCheck %s |
| 2 | |
| 3 | 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" |
| 4 | target triple = "thumbv7-apple-ios6.0.0" |
| 5 | |
| 6 | define void @test_geps() { |
| 7 | ; Cost of scalar integer geps should be one. We can't always expect it to be |
| 8 | ; folded into the instruction addressing mode. |
| 9 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i8* |
| 10 | %a0 = getelementptr inbounds i8* undef, i32 0 |
| 11 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i16* |
| 12 | %a1 = getelementptr inbounds i16* undef, i32 0 |
| 13 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i32* |
| 14 | %a2 = getelementptr inbounds i32* undef, i32 0 |
| 15 | |
| 16 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i64* |
| 17 | %a3 = getelementptr inbounds i64* undef, i32 0 |
| 18 | |
| 19 | ; Cost of scalar floating point geps should be one. We cannot fold the address |
| 20 | ; computation. |
| 21 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds float* |
| 22 | %a4 = getelementptr inbounds float* undef, i32 0 |
| 23 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds double* |
| 24 | %a5 = getelementptr inbounds double* undef, i32 0 |
| 25 | |
| 26 | |
| 27 | ; Cost of vector geps should be one. We cannot fold the address computation. |
| 28 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i8>* |
| 29 | %a7 = getelementptr inbounds <4 x i8>* undef, i32 0 |
| 30 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i16>* |
| 31 | %a8 = getelementptr inbounds <4 x i16>* undef, i32 0 |
| 32 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i32>* |
| 33 | %a9 = getelementptr inbounds <4 x i32>* undef, i32 0 |
| 34 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i64>* |
| 35 | %a10 = getelementptr inbounds <4 x i64>* undef, i32 0 |
| 36 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x float>* |
| 37 | %a11 = getelementptr inbounds <4 x float>* undef, i32 0 |
| 38 | ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x double>* |
| 39 | %a12 = getelementptr inbounds <4 x double>* undef, i32 0 |
| 40 | |
| 41 | |
| 42 | ret void |
| 43 | } |