Home | History | Annotate | Download | only in Bitcode
      1 ; RUN:  llvm-dis < %s.bc| FileCheck %s
      2 
      3 ; memOperations.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
      4 ; The test checks that LLVM does not misread memory related instructions of
      5 ; older bitcode files.
      6 
      7 define void @alloca(){
      8 entry:
      9 ; CHECK: %res1 = alloca i8
     10   %res1 = alloca i8
     11   
     12 ; CHECK-NEXT: %res2 = alloca i8, i32 2
     13   %res2 = alloca i8, i32 2
     14 
     15 ; CHECK-NEXT: %res3 = alloca i8, i32 2, align 4
     16   %res3 = alloca i8, i32 2, align 4
     17   
     18 ; CHECK-NEXT: %res4 = alloca i8, align 4
     19   %res4 = alloca i8, align 4
     20   
     21   ret void
     22 }
     23 
     24 define void @load(){
     25 entry:
     26   %ptr1 = alloca i8
     27   store i8 2, i8* %ptr1
     28   
     29 ; CHECK: %res1 = load i8* %ptr1
     30   %res1 = load i8* %ptr1
     31   
     32 ; CHECK-NEXT: %res2 = load volatile i8* %ptr1
     33   %res2 = load volatile i8* %ptr1
     34   
     35 ; CHECK-NEXT: %res3 = load i8* %ptr1, align 1
     36   %res3 = load i8* %ptr1, align 1
     37   
     38 ; CHECK-NEXT: %res4 = load volatile i8* %ptr1, align 1
     39   %res4 = load volatile i8* %ptr1, align 1
     40   
     41 ; CHECK-NEXT: %res5 = load i8* %ptr1, !nontemporal !0
     42   %res5 = load i8* %ptr1, !nontemporal !0
     43   
     44 ; CHECK-NEXT: %res6 = load volatile i8* %ptr1, !nontemporal !0
     45   %res6 = load volatile i8* %ptr1, !nontemporal !0
     46   
     47 ; CHECK-NEXT: %res7 = load i8* %ptr1, align 1, !nontemporal !0
     48   %res7 = load i8* %ptr1, align 1, !nontemporal !0
     49   
     50 ; CHECK-NEXT: %res8 = load volatile i8* %ptr1, align 1, !nontemporal !0
     51   %res8 = load volatile i8* %ptr1, align 1, !nontemporal !0
     52   
     53 ; CHECK-NEXT: %res9 = load i8* %ptr1, !invariant.load !1
     54   %res9 = load i8* %ptr1, !invariant.load !1
     55   
     56 ; CHECK-NEXT: %res10 = load volatile i8* %ptr1, !invariant.load !1
     57   %res10 = load volatile i8* %ptr1, !invariant.load !1
     58   
     59 ; CHECK-NEXT: %res11 = load i8* %ptr1, align 1, !invariant.load !1
     60   %res11 = load i8* %ptr1, align 1, !invariant.load !1
     61   
     62 ; CHECK-NEXT: %res12 = load volatile i8* %ptr1, align 1, !invariant.load !1
     63   %res12 = load volatile i8* %ptr1, align 1, !invariant.load !1
     64   
     65 ; CHECK-NEXT: %res13 = load i8* %ptr1, {{[(!nontemporal !0, !invariant.load !1) | (!invariant.load !1, !nontemporal !0)]}}
     66   %res13 = load i8* %ptr1, !nontemporal !0, !invariant.load !1
     67   
     68 ; CHECK-NEXT: %res14 = load volatile i8* %ptr1, {{[(!nontemporal !0, !invariant.load !1) | (!invariant.load !1, !nontemporal !0)]}}
     69   %res14 = load volatile i8* %ptr1, !nontemporal !0, !invariant.load !1
     70   
     71 ; CHECK-NEXT: %res15 = load i8* %ptr1, align 1, {{[(!nontemporal !0, !invariant.load !1) | (!invariant.load !1, !nontemporal !0)]}}
     72   %res15 = load i8* %ptr1, align 1, !nontemporal !0, !invariant.load !1
     73   
     74 ; CHECK-NEXT: %res16 = load volatile i8* %ptr1, align 1, {{[(!nontemporal !0, !invariant.load !1) | (!invariant.load !1, !nontemporal !0)]}}
     75   %res16 = load volatile i8* %ptr1, align 1, !nontemporal !0, !invariant.load !1
     76   
     77   ret void
     78 }
     79 
     80 define void @loadAtomic(){
     81 entry:
     82   %ptr1 = alloca i8
     83   store i8 2, i8* %ptr1
     84   
     85 ; CHECK: %res1 = load atomic i8* %ptr1 unordered, align 1
     86   %res1 = load atomic i8* %ptr1 unordered, align 1
     87   
     88 ; CHECK-NEXT: %res2 = load atomic i8* %ptr1 monotonic, align 1
     89   %res2 = load atomic i8* %ptr1 monotonic, align 1
     90   
     91 ; CHECK-NEXT: %res3 = load atomic i8* %ptr1 acquire, align 1
     92   %res3 = load atomic i8* %ptr1 acquire, align 1
     93   
     94 ; CHECK-NEXT: %res4 = load atomic i8* %ptr1 seq_cst, align 1
     95   %res4 = load atomic i8* %ptr1 seq_cst, align 1
     96   
     97 ; CHECK-NEXT: %res5 = load atomic volatile i8* %ptr1 unordered, align 1
     98   %res5 = load atomic volatile i8* %ptr1 unordered, align 1
     99   
    100 ; CHECK-NEXT: %res6 = load atomic volatile i8* %ptr1 monotonic, align 1
    101   %res6 = load atomic volatile i8* %ptr1 monotonic, align 1
    102   
    103 ; CHECK-NEXT: %res7 = load atomic volatile i8* %ptr1 acquire, align 1
    104   %res7 = load atomic volatile i8* %ptr1 acquire, align 1
    105   
    106 ; CHECK-NEXT: %res8 = load atomic volatile i8* %ptr1 seq_cst, align 1
    107   %res8 = load atomic volatile i8* %ptr1 seq_cst, align 1
    108   
    109 ; CHECK-NEXT: %res9 = load atomic i8* %ptr1 singlethread unordered, align 1
    110   %res9 = load atomic i8* %ptr1 singlethread unordered, align 1
    111   
    112 ; CHECK-NEXT: %res10 = load atomic i8* %ptr1 singlethread monotonic, align 1
    113   %res10 = load atomic i8* %ptr1 singlethread monotonic, align 1
    114   
    115 ; CHECK-NEXT: %res11 = load atomic i8* %ptr1 singlethread acquire, align 1
    116   %res11 = load atomic i8* %ptr1 singlethread acquire, align 1
    117   
    118 ; CHECK-NEXT: %res12 = load atomic i8* %ptr1 singlethread seq_cst, align 1
    119   %res12 = load atomic i8* %ptr1 singlethread seq_cst, align 1
    120   
    121 ; CHECK-NEXT: %res13 = load atomic volatile i8* %ptr1 singlethread unordered, align 1
    122   %res13 = load atomic volatile i8* %ptr1 singlethread unordered, align 1
    123   
    124 ; CHECK-NEXT: %res14 = load atomic volatile i8* %ptr1 singlethread monotonic, align 1
    125   %res14 = load atomic volatile i8* %ptr1 singlethread monotonic, align 1
    126   
    127 ; CHECK-NEXT: %res15 = load atomic volatile i8* %ptr1 singlethread acquire, align 1
    128   %res15 = load atomic volatile i8* %ptr1 singlethread acquire, align 1
    129   
    130 ; CHECK-NEXT: %res16 = load atomic volatile i8* %ptr1 singlethread seq_cst, align 1
    131   %res16 = load atomic volatile i8* %ptr1 singlethread seq_cst, align 1
    132   
    133   ret void
    134 }
    135 
    136 define void @store(){
    137 entry:
    138   %ptr1 = alloca i8
    139   
    140 ; CHECK: store i8 2, i8* %ptr1
    141   store i8 2, i8* %ptr1
    142   
    143 ; CHECK-NEXT: store volatile i8 2, i8* %ptr1
    144   store volatile i8 2, i8* %ptr1
    145   
    146 ; CHECK-NEXT: store i8 2, i8* %ptr1, align 1
    147   store i8 2, i8* %ptr1, align 1
    148   
    149 ; CHECK-NEXT: store volatile i8 2, i8* %ptr1, align 1
    150   store volatile i8 2, i8* %ptr1, align 1
    151   
    152 ; CHECK-NEXT: store i8 2, i8* %ptr1, !nontemporal !0
    153   store i8 2, i8* %ptr1, !nontemporal !0
    154   
    155 ; CHECK-NEXT: store volatile i8 2, i8* %ptr1, !nontemporal !0
    156   store volatile i8 2, i8* %ptr1, !nontemporal !0
    157   
    158 ; CHECK-NEXT: store i8 2, i8* %ptr1, align 1, !nontemporal !0
    159   store i8 2, i8* %ptr1, align 1, !nontemporal !0
    160   
    161 ; CHECK-NEXT: store volatile i8 2, i8* %ptr1, align 1, !nontemporal !0
    162   store volatile i8 2, i8* %ptr1, align 1, !nontemporal !0
    163   
    164   ret void
    165 }
    166 
    167 define void @storeAtomic(){
    168 entry:
    169   %ptr1 = alloca i8
    170   
    171 ; CHECK: store atomic i8 2, i8* %ptr1 unordered, align 1
    172   store atomic i8 2, i8* %ptr1 unordered, align 1
    173   
    174 ; CHECK-NEXT: store atomic i8 2, i8* %ptr1 monotonic, align 1
    175   store atomic i8 2, i8* %ptr1 monotonic, align 1
    176   
    177 ; CHECK-NEXT: store atomic i8 2, i8* %ptr1 release, align 1
    178   store atomic i8 2, i8* %ptr1 release, align 1
    179   
    180 ; CHECK-NEXT: store atomic i8 2, i8* %ptr1 seq_cst, align 1
    181   store atomic i8 2, i8* %ptr1 seq_cst, align 1
    182   
    183 ; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 unordered, align 1
    184   store atomic volatile i8 2, i8* %ptr1 unordered, align 1
    185   
    186 ; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 monotonic, align 1
    187   store atomic volatile i8 2, i8* %ptr1 monotonic, align 1
    188   
    189 ; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 release, align 1
    190   store atomic volatile i8 2, i8* %ptr1 release, align 1
    191   
    192 ; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 seq_cst, align 1
    193   store atomic volatile i8 2, i8* %ptr1 seq_cst, align 1
    194   
    195 ; CHECK-NEXT: store atomic i8 2, i8* %ptr1 singlethread unordered, align 1
    196   store atomic i8 2, i8* %ptr1 singlethread unordered, align 1
    197   
    198 ; CHECK-NEXT: store atomic i8 2, i8* %ptr1 singlethread monotonic, align 1
    199   store atomic i8 2, i8* %ptr1 singlethread monotonic, align 1
    200   
    201 ; CHECK-NEXT: store atomic i8 2, i8* %ptr1 singlethread release, align 1
    202   store atomic i8 2, i8* %ptr1 singlethread release, align 1
    203   
    204 ; CHECK-NEXT: store atomic i8 2, i8* %ptr1 singlethread seq_cst, align 1
    205   store atomic i8 2, i8* %ptr1 singlethread seq_cst, align 1
    206   
    207 ; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 singlethread unordered, align 1
    208   store atomic volatile i8 2, i8* %ptr1 singlethread unordered, align 1
    209   
    210 ; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 singlethread monotonic, align 1
    211   store atomic volatile i8 2, i8* %ptr1 singlethread monotonic, align 1
    212   
    213 ; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 singlethread release, align 1
    214   store atomic volatile i8 2, i8* %ptr1 singlethread release, align 1
    215   
    216 ; CHECK-NEXT: store atomic volatile i8 2, i8* %ptr1 singlethread seq_cst, align 1
    217   store atomic volatile i8 2, i8* %ptr1 singlethread seq_cst, align 1
    218   
    219   ret void
    220 }
    221 
    222 define void @cmpxchg(i32* %ptr,i32 %cmp,i32 %new){
    223 entry:
    224   ;cmpxchg [volatile] <ty>* <pointer>, <ty> <cmp>, <ty> <new> [singlethread] <ordering>
    225 
    226 ; CHECK: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new monotonic monotonic
    227 ; CHECK-NEXT: %res1 = extractvalue { i32, i1 } [[TMP]], 0
    228   %res1 = cmpxchg i32* %ptr, i32 %cmp, i32 %new monotonic monotonic
    229   
    230 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new monotonic monotonic
    231 ; CHECK-NEXT: %res2 = extractvalue { i32, i1 } [[TMP]], 0
    232   %res2 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new monotonic monotonic
    233   
    234 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new singlethread monotonic monotonic
    235 ; CHECK-NEXT: %res3 = extractvalue { i32, i1 } [[TMP]], 0
    236   %res3 = cmpxchg i32* %ptr, i32 %cmp, i32 %new singlethread monotonic monotonic
    237   
    238 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new singlethread monotonic monotonic
    239 ; CHECK-NEXT: %res4 = extractvalue { i32, i1 } [[TMP]], 0
    240   %res4 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new singlethread monotonic monotonic
    241   
    242   
    243 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new acquire acquire
    244 ; CHECK-NEXT: %res5 = extractvalue { i32, i1 } [[TMP]], 0
    245   %res5 = cmpxchg i32* %ptr, i32 %cmp, i32 %new acquire acquire
    246   
    247 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new acquire acquire
    248 ; CHECK-NEXT: %res6 = extractvalue { i32, i1 } [[TMP]], 0
    249   %res6 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new acquire acquire
    250   
    251 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new singlethread acquire acquire
    252 ; CHECK-NEXT: %res7 = extractvalue { i32, i1 } [[TMP]], 0
    253   %res7 = cmpxchg i32* %ptr, i32 %cmp, i32 %new singlethread acquire acquire
    254   
    255 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new singlethread acquire acquire
    256 ; CHECK-NEXT: %res8 = extractvalue { i32, i1 } [[TMP]], 0
    257   %res8 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new singlethread acquire acquire
    258   
    259   
    260 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new release monotonic
    261 ; CHECK-NEXT: %res9 = extractvalue { i32, i1 } [[TMP]], 0
    262   %res9 = cmpxchg i32* %ptr, i32 %cmp, i32 %new release monotonic
    263   
    264 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new release monotonic
    265 ; CHECK-NEXT: %res10 = extractvalue { i32, i1 } [[TMP]], 0
    266   %res10 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new release monotonic
    267   
    268 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new singlethread release monotonic
    269 ; CHECK-NEXT: %res11 = extractvalue { i32, i1 } [[TMP]], 0
    270   %res11 = cmpxchg i32* %ptr, i32 %cmp, i32 %new singlethread release monotonic
    271   
    272 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new singlethread release monotonic
    273 ; CHECK-NEXT: %res12 = extractvalue { i32, i1 } [[TMP]], 0
    274   %res12 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new singlethread release monotonic
    275   
    276   
    277 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new acq_rel acquire
    278 ; CHECK-NEXT: %res13 = extractvalue { i32, i1 } [[TMP]], 0
    279   %res13 = cmpxchg i32* %ptr, i32 %cmp, i32 %new acq_rel acquire
    280   
    281 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new acq_rel acquire
    282 ; CHECK-NEXT: %res14 = extractvalue { i32, i1 } [[TMP]], 0
    283   %res14 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new acq_rel acquire
    284   
    285 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new singlethread acq_rel acquire
    286 ; CHECK-NEXT: %res15 = extractvalue { i32, i1 } [[TMP]], 0
    287   %res15 = cmpxchg i32* %ptr, i32 %cmp, i32 %new singlethread acq_rel acquire
    288   
    289 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new singlethread acq_rel acquire
    290 ; CHECK-NEXT: %res16 = extractvalue { i32, i1 } [[TMP]], 0
    291   %res16 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new singlethread acq_rel acquire
    292   
    293   
    294 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new seq_cst seq_cst
    295 ; CHECK-NEXT: %res17 = extractvalue { i32, i1 } [[TMP]], 0
    296   %res17 = cmpxchg i32* %ptr, i32 %cmp, i32 %new seq_cst seq_cst
    297   
    298 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new seq_cst seq_cst
    299 ; CHECK-NEXT: %res18 = extractvalue { i32, i1 } [[TMP]], 0
    300   %res18 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new seq_cst seq_cst
    301   
    302 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg i32* %ptr, i32 %cmp, i32 %new singlethread seq_cst seq_cst
    303 ; CHECK-NEXT: %res19 = extractvalue { i32, i1 } [[TMP]], 0
    304   %res19 = cmpxchg i32* %ptr, i32 %cmp, i32 %new singlethread seq_cst seq_cst
    305   
    306 ; CHECK-NEXT: [[TMP:%[a-z0-9]+]] = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new singlethread seq_cst seq_cst
    307 ; CHECK-NEXT: %res20 = extractvalue { i32, i1 } [[TMP]], 0
    308   %res20 = cmpxchg volatile i32* %ptr, i32 %cmp, i32 %new singlethread seq_cst seq_cst
    309 
    310   ret void
    311 }
    312 
    313 define void @getelementptr({i8, i8}* %s, <4 x i8*> %ptrs, <4 x i64> %offsets ){
    314 entry:
    315 ; CHECK: %res1 = getelementptr { i8, i8 }* %s, i32 1, i32 1
    316   %res1 = getelementptr {i8, i8}* %s, i32 1, i32 1
    317   
    318 ; CHECK-NEXT: %res2 = getelementptr inbounds { i8, i8 }* %s, i32 1, i32 1
    319   %res2 = getelementptr inbounds {i8, i8}* %s, i32 1, i32 1
    320   
    321 ; CHECK-NEXT: %res3 = getelementptr <4 x i8*> %ptrs, <4 x i64> %offsets
    322   %res3 = getelementptr <4 x i8*> %ptrs, <4 x i64> %offsets
    323   
    324   ret void
    325 }
    326 
    327 !0 = metadata !{ i32 1 }
    328 !1 = metadata !{}