Home | History | Annotate | Download | only in X86
      1 ; RUN: opt -S %s -atomic-expand -mtriple=x86_64-linux-gnu | FileCheck %s
      2 
      3 ; This file tests the functions `llvm::convertAtomicLoadToIntegerType` and
      4 ; `llvm::convertAtomicStoreToIntegerType`. If X86 stops using this 
      5 ; functionality, please move this test to a target which still is.
      6 
      7 define float @float_load_expand(float* %ptr) {
      8 ; CHECK-LABEL: @float_load_expand
      9 ; CHECK: %1 = bitcast float* %ptr to i32*
     10 ; CHECK: %2 = load atomic i32, i32* %1 unordered, align 4
     11 ; CHECK: %3 = bitcast i32 %2 to float
     12 ; CHECK: ret float %3
     13   %res = load atomic float, float* %ptr unordered, align 4
     14   ret float %res
     15 }
     16 
     17 define float @float_load_expand_seq_cst(float* %ptr) {
     18 ; CHECK-LABEL: @float_load_expand_seq_cst
     19 ; CHECK: %1 = bitcast float* %ptr to i32*
     20 ; CHECK: %2 = load atomic i32, i32* %1 seq_cst, align 4
     21 ; CHECK: %3 = bitcast i32 %2 to float
     22 ; CHECK: ret float %3
     23   %res = load atomic float, float* %ptr seq_cst, align 4
     24   ret float %res
     25 }
     26 
     27 define float @float_load_expand_vol(float* %ptr) {
     28 ; CHECK-LABEL: @float_load_expand_vol
     29 ; CHECK: %1 = bitcast float* %ptr to i32*
     30 ; CHECK: %2 = load atomic volatile i32, i32* %1 unordered, align 4
     31 ; CHECK: %3 = bitcast i32 %2 to float
     32 ; CHECK: ret float %3
     33   %res = load atomic volatile float, float* %ptr unordered, align 4
     34   ret float %res
     35 }
     36 
     37 define float @float_load_expand_addr1(float addrspace(1)* %ptr) {
     38 ; CHECK-LABEL: @float_load_expand_addr1
     39 ; CHECK: %1 = bitcast float addrspace(1)* %ptr to i32 addrspace(1)*
     40 ; CHECK: %2 = load atomic i32, i32 addrspace(1)* %1 unordered, align 4
     41 ; CHECK: %3 = bitcast i32 %2 to float
     42 ; CHECK: ret float %3
     43   %res = load atomic float, float addrspace(1)* %ptr unordered, align 4
     44   ret float %res
     45 }
     46 
     47 define void @float_store_expand(float* %ptr, float %v) {
     48 ; CHECK-LABEL: @float_store_expand
     49 ; CHECK: %1 = bitcast float %v to i32
     50 ; CHECK: %2 = bitcast float* %ptr to i32*
     51 ; CHECK: store atomic i32 %1, i32* %2 unordered, align 4
     52   store atomic float %v, float* %ptr unordered, align 4
     53   ret void
     54 }
     55 
     56 define void @float_store_expand_seq_cst(float* %ptr, float %v) {
     57 ; CHECK-LABEL: @float_store_expand_seq_cst
     58 ; CHECK: %1 = bitcast float %v to i32
     59 ; CHECK: %2 = bitcast float* %ptr to i32*
     60 ; CHECK: store atomic i32 %1, i32* %2 seq_cst, align 4
     61   store atomic float %v, float* %ptr seq_cst, align 4
     62   ret void
     63 }
     64 
     65 define void @float_store_expand_vol(float* %ptr, float %v) {
     66 ; CHECK-LABEL: @float_store_expand_vol
     67 ; CHECK: %1 = bitcast float %v to i32
     68 ; CHECK: %2 = bitcast float* %ptr to i32*
     69 ; CHECK: store atomic volatile i32 %1, i32* %2 unordered, align 4
     70   store atomic volatile float %v, float* %ptr unordered, align 4
     71   ret void
     72 }
     73 
     74 define void @float_store_expand_addr1(float addrspace(1)* %ptr, float %v) {
     75 ; CHECK-LABEL: @float_store_expand_addr1
     76 ; CHECK: %1 = bitcast float %v to i32
     77 ; CHECK: %2 = bitcast float addrspace(1)* %ptr to i32 addrspace(1)*
     78 ; CHECK: store atomic i32 %1, i32 addrspace(1)* %2 unordered, align 4
     79   store atomic float %v, float addrspace(1)* %ptr unordered, align 4
     80   ret void
     81 }
     82 
     83