125 lines · plain
1; RUN: llvm-dis < %s.bc| FileCheck %s2 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 of5; older bitcode files.6 7;global variable address8; CHECK: @X = global i32 09@X = global i32 010; CHECK: @Y = global i32 111@Y = global i32 112; CHECK: @Z = global [2 x ptr] [ptr @X, ptr @Y]13@Z = global [2 x i32*] [i32* @X, i32* @Y]14 15 16define void @SimpleConstants(i32 %x) {17entry:18; null19; CHECK: store i32 %x, ptr null20 store i32 %x, i32* null21 22; boolean23; CHECK-NEXT: %res1 = fcmp true float 1.000000e+00, 1.000000e+00 24 %res1 = fcmp true float 1.0, 1.025; CHECK-NEXT: %res2 = fcmp false float 1.000000e+00, 1.000000e+0026 %res2 = fcmp false float 1.0, 1.027 28;integer29; CHECK-NEXT: %res3 = add i32 0, 030 %res3 = add i32 0, 031 32;float33; CHECK-NEXT: %res4 = fadd float 0.000000e+00, 0.000000e+0034 %res4 = fadd float 0.0, 0.035 36 ret void37}38 39define void @ComplexConstants(<2 x i32> %x){40entry:41;constant structure42; CHECK: %res1 = extractvalue { i32, float } { i32 1, float 2.000000e+00 }, 043 %res1 = extractvalue {i32, float} {i32 1, float 2.0}, 044 45;const array46; CHECK-NEXT: %res2 = extractvalue [2 x i32] [i32 1, i32 2], 047 %res2 = extractvalue [2 x i32] [i32 1, i32 2], 048 49;const vector50; CHECK-NEXT: %res3 = add <2 x i32> splat (i32 1)51 %res3 = add <2 x i32> <i32 1, i32 1>, <i32 1, i32 1>52 53;zeroinitializer54; CHECK-NEXT: %res4 = add <2 x i32> %x, zeroinitializer55 %res4 = add <2 x i32> %x, zeroinitializer56 57 ret void58}59 60define void @OtherConstants(i32 %x, i8* %Addr){61entry:62 ;undef63 ; CHECK: %res1 = add i32 %x, undef 64 %res1 = add i32 %x, undef65 66 ;poison67 ; CHECK-NEXT: %poison = sub nuw i32 0, 168 %poison = sub nuw i32 0, 169 70 ;address of basic block71 ; CHECK-NEXT: %res2 = icmp eq ptr blockaddress(@OtherConstants, %Next), null72 %res2 = icmp eq i8* blockaddress(@OtherConstants, %Next), null73 br label %Next74 Next: 75 ret void76}77 78define void @OtherConstants2(){79entry:80 ; CHECK: trunc i32 1 to i881 trunc i32 1 to i882 ; CHECK-NEXT: zext i8 1 to i3283 zext i8 1 to i3284 ; CHECK-NEXT: sext i8 1 to i3285 sext i8 1 to i3286 ; CHECK-NEXT: fptrunc double 1.000000e+00 to float87 fptrunc double 1.0 to float88 ; CHECK-NEXT: fpext float 1.000000e+00 to double89 fpext float 1.0 to double90 ; CHECK-NEXT: fptosi float 1.000000e+00 to i3291 fptosi float 1.0 to i3292 ; CHECK-NEXT: uitofp i32 1 to float93 uitofp i32 1 to float94 ; CHECK-NEXT: sitofp i32 -1 to float95 sitofp i32 -1 to float96 ; CHECK-NEXT: ptrtoint ptr @X to i3297 ptrtoint i32* @X to i3298 ; CHECK-NEXT: inttoptr i8 1 to ptr99 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, ptr @X, i32 0103 getelementptr i32, i32* @X, i32 0104 ; CHECK-NEXT: getelementptr inbounds i32, ptr @X, i32 0105 getelementptr inbounds i32, i32* @X, i32 0106 ; CHECK: select i1 true, i32 1, i32 0107 select i1 true ,i32 1, i32 0108 ; CHECK-NEXT: icmp eq i32 1, 0109 icmp eq i32 1, 0110 ; CHECK-NEXT: fcmp oeq float 1.000000e+00, 0.000000e+00111 fcmp oeq float 1.0, 0.0112 ; CHECK-NEXT: extractelement <2 x i32> splat (i32 1)113 extractelement <2 x i32> <i32 1, i32 1>, i32 1114 ; CHECK-NEXT: insertelement <2 x i32> splat (i32 1), i32 0, i32 1115 insertelement <2 x i32> <i32 1, i32 1>, i32 0, i32 1116 ; CHECK-NEXT: shufflevector <2 x i32> splat (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 }, 0119 extractvalue { i32, float } { i32 1, float 2.0 }, 0120 ; CHECK-NEXT: insertvalue { i32, float } { i32 1, float 2.000000e+00 }, i32 0, 0121 insertvalue { i32, float } { i32 1, float 2.0 }, i32 0, 0122 123 ret void124}125