Add a triple to switch.ll test.
[oota-llvm.git] / test / CodeGen / X86 / codegen-prepare.ll
1 ; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux -addr-sink-using-gep=1 | FileCheck %s
3
4 ; Check that the CodeGenPrepare Pass
5 ; does not wrongly rewrite the address computed by Instruction %4
6 ; as [12 + Base:%this].
7
8 ; This test makes sure that:
9 ; - both the store and the first load instructions
10 ;   within basic block labeled 'if.then' are not removed. 
11 ; - the store instruction stores a value at address [60 + %this]
12 ; - the first load instruction loads a value at address [12 + %this]
13
14 %class.A = type { %struct.B }
15 %struct.B = type { %class.C, %class.D, %class.C, %class.D }
16 %class.C = type { float, float, float }
17 %class.D = type { [3 x %class.C] }
18
19 define linkonce_odr void @foo(%class.A* nocapture %this, i32 %BoolValue) nounwind uwtable {
20 entry:
21   %cmp = icmp eq i32 %BoolValue, 0
22   %address1 = getelementptr inbounds %class.A, %class.A* %this, i64 0, i32 0, i32 3
23   %address2 = getelementptr inbounds %class.A, %class.A* %this, i64 0, i32 0, i32 1
24   br i1 %cmp, label %if.else, label %if.then
25
26 if.then:                                         ; preds = %entry
27   %0 = getelementptr inbounds %class.D, %class.D* %address2, i64 0, i32 0, i64 0, i32 0
28   %1 = load float, float* %0, align 4 
29   %2 = getelementptr inbounds float, float* %0, i64 3
30   %3 = load float, float* %2, align 4 
31   %4 = getelementptr inbounds %class.D, %class.D* %address1, i64 0, i32 0, i64 0, i32 0
32   store float %1, float* %4, align 4
33   br label %if.end
34
35 if.else:                                          ; preds = %entry
36   br label %if.end
37
38 if.end:                                           ; preds = %if.then, %if.else, %entry
39   ret void
40 }
41
42 ; CHECK-LABEL: foo:
43 ; CHECK: movss 12([[THIS:%[a-zA-Z0-9]+]]), [[REGISTER:%[a-zA-Z0-9]+]]
44 ; CHECK-NEXT: movss [[REGISTER]], 60([[THIS]])
45