Home | History | Annotate | Download | only in Bitcode
      1 ; RUN:  llvm-dis < %s.bc| FileCheck %s
      2 
      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
      5 ; older bitcode files.
      6 
      7 ;global variable address
      8 ; CHECK: @X = global i32 0
      9 @X = global i32 0
     10 ; CHECK: @Y = global i32 1
     11 @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]
     14 
     15 
     16 define void @SimpleConstants(i32 %x) {
     17 entry:
     18 ; null
     19 ; CHECK: store i32 %x, i32* null
     20   store i32 %x, i32* null
     21  
     22 ; boolean
     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
     27 
     28 ;integer
     29 ; CHECK-NEXT: %res3 = add i32 0, 0
     30   %res3 = add i32 0, 0
     31 
     32 ;float
     33 ; CHECK-NEXT: %res4 = fadd float 0.000000e+00, 0.000000e+00
     34   %res4 = fadd float 0.0, 0.0
     35 
     36   ret void
     37 }
     38 
     39 define void @ComplexConstants(<2 x i32> %x){
     40 entry:
     41 ;constant structure
     42 ; CHECK: %res1 = extractvalue { i32, float } { i32 1, float 2.000000e+00 }, 0
     43   %res1 = extractvalue {i32, float} {i32 1, float 2.0}, 0
     44   
     45 ;const array
     46 ; CHECK-NEXT: %res2 = extractvalue [2 x i32] [i32 1, i32 2], 0
     47   %res2 = extractvalue [2 x i32] [i32 1, i32 2], 0
     48   
     49 ;const vector
     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>
     52   
     53 ;zeroinitializer
     54 ; CHECK-NEXT: %res4 = add <2 x i32> %x, zeroinitializer
     55   %res4 = add <2 x i32> %x, zeroinitializer
     56   
     57   ret void
     58 }
     59 
     60 define void @OtherConstants(i32 %x, i8* %Addr){
     61 entry:
     62   ;undef
     63   ; CHECK: %res1 = add i32 %x, undef 
     64   %res1 = add i32 %x, undef
     65   
     66   ;poison
     67   ; CHECK-NEXT: %poison = sub nuw i32 0, 1
     68   %poison = sub nuw i32 0, 1
     69   
     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
     73   br label %Next
     74   Next: 
     75   ret void
     76 }
     77 
     78 define void @OtherConstants2(){
     79 entry:
     80   ; CHECK: trunc i32 1 to i8
     81   trunc i32 1 to i8
     82   ; CHECK-NEXT: zext i8 1 to i32
     83   zext i8 1 to i32
     84   ; CHECK-NEXT: sext i8 1 to i32
     85   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
     93   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*
     99   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
    109   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
    122   
    123   ret void
    124 }