1 ; RUN: llvm-dis < %s.bc| FileCheck %s
3 ; constantsTest.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
4 ; The test checks that LLVM does not misread binary float instructions of
7 ;global variable address
8 ; CHECK: @X = global i32 0
10 ; CHECK: @Y = global i32 1
12 ; CHECK: @Z = global [2 x i32*] [i32* @X, i32* @Y]
13 @Z = global [2 x i32*] [i32* @X, i32* @Y]
16 define void @SimpleConstants(i32 %x) {
19 ; CHECK: store i32 %x, i32* null
20 store i32 %x, i32* null
23 ; CHECK-NEXT: %res1 = fcmp true float 1.000000e+00, 1.000000e+00
24 %res1 = fcmp true float 1.0, 1.0
25 ; CHECK-NEXT: %res2 = fcmp false float 1.000000e+00, 1.000000e+00
26 %res2 = fcmp false float 1.0, 1.0
29 ; CHECK-NEXT: %res3 = add i32 0, 0
33 ; CHECK-NEXT: %res4 = fadd float 0.000000e+00, 0.000000e+00
34 %res4 = fadd float 0.0, 0.0
39 define void @ComplexConstants(<2 x i32> %x){
42 ; CHECK: %res1 = extractvalue { i32, float } { i32 1, float 2.000000e+00 }, 0
43 %res1 = extractvalue {i32, float} {i32 1, float 2.0}, 0
46 ; CHECK-NEXT: %res2 = extractvalue [2 x i32] [i32 1, i32 2], 0
47 %res2 = extractvalue [2 x i32] [i32 1, i32 2], 0
50 ; CHECK-NEXT: %res3 = add <2 x i32> <i32 1, i32 1>, <i32 1, i32 1>
51 %res3 = add <2 x i32> <i32 1, i32 1>, <i32 1, i32 1>
54 ; CHECK-NEXT: %res4 = add <2 x i32> %x, zeroinitializer
55 %res4 = add <2 x i32> %x, zeroinitializer
60 define void @OtherConstants(i32 %x, i8* %Addr){
63 ; CHECK: %res1 = add i32 %x, undef
64 %res1 = add i32 %x, undef
67 ; CHECK-NEXT: %poison = sub nuw i32 0, 1
68 %poison = sub nuw i32 0, 1
70 ;address of basic block
71 ; CHECK-NEXT: %res2 = icmp eq i8* blockaddress(@OtherConstants, %Next), null
72 %res2 = icmp eq i8* blockaddress(@OtherConstants, %Next), null
78 define void @OtherConstants2(){
80 ; CHECK: trunc i32 1 to i8
82 ; CHECK-NEXT: zext i8 1 to i32
84 ; CHECK-NEXT: sext i8 1 to i32
86 ; CHECK-NEXT: fptrunc double 1.000000e+00 to float
87 fptrunc double 1.0 to float
88 ; CHECK-NEXT: fpext float 1.000000e+00 to double
89 fpext float 1.0 to double
90 ; CHECK-NEXT: fptosi float 1.000000e+00 to i32
91 fptosi float 1.0 to i32
92 ; CHECK-NEXT: uitofp i32 1 to float
94 ; CHECK-NEXT: sitofp i32 -1 to float
95 sitofp i32 -1 to float
96 ; CHECK-NEXT: ptrtoint i32* @X to i32
97 ptrtoint i32* @X to i32
98 ; CHECK-NEXT: inttoptr i8 1 to i8*
100 ; CHECK-NEXT: bitcast i32 1 to <2 x i16>
101 bitcast i32 1 to <2 x i16>
102 ; CHECK-NEXT: getelementptr i32, i32* @X, i32 0
103 getelementptr i32, i32* @X, i32 0
104 ; CHECK-NEXT: getelementptr inbounds i32, i32* @X, i32 0
105 getelementptr inbounds i32, i32* @X, i32 0
106 ; CHECK: select i1 true, i32 1, i32 0
107 select i1 true ,i32 1, i32 0
108 ; CHECK-NEXT: icmp eq i32 1, 0
110 ; CHECK-NEXT: fcmp oeq float 1.000000e+00, 0.000000e+00
111 fcmp oeq float 1.0, 0.0
112 ; CHECK-NEXT: extractelement <2 x i32> <i32 1, i32 1>, i32 1
113 extractelement <2 x i32> <i32 1, i32 1>, i32 1
114 ; CHECK-NEXT: insertelement <2 x i32> <i32 1, i32 1>, i32 0, i32 1
115 insertelement <2 x i32> <i32 1, i32 1>, i32 0, i32 1
116 ; CHECK-NEXT: shufflevector <2 x i32> <i32 1, i32 1>, <2 x i32> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
117 shufflevector <2 x i32> <i32 1, i32 1>, <2 x i32> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
118 ; CHECK-NEXT: extractvalue { i32, float } { i32 1, float 2.000000e+00 }, 0
119 extractvalue { i32, float } { i32 1, float 2.0 }, 0
120 ; CHECK-NEXT: insertvalue { i32, float } { i32 1, float 2.000000e+00 }, i32 0, 0
121 insertvalue { i32, float } { i32 1, float 2.0 }, i32 0, 0