reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
; RUN: opt -S %s -atomic-expand -mtriple=x86_64-linux-gnu | FileCheck %s

; This file tests the functions `llvm::convertAtomicLoadToIntegerType` and
; `llvm::convertAtomicStoreToIntegerType`. If X86 stops using this 
; functionality, please move this test to a target which still is.

define float @float_load_expand(float* %ptr) {
; CHECK-LABEL: @float_load_expand
; CHECK: %1 = bitcast float* %ptr to i32*
; CHECK: %2 = load atomic i32, i32* %1 unordered, align 4
; CHECK: %3 = bitcast i32 %2 to float
; CHECK: ret float %3
  %res = load atomic float, float* %ptr unordered, align 4
  ret float %res
}

define float @float_load_expand_seq_cst(float* %ptr) {
; CHECK-LABEL: @float_load_expand_seq_cst
; CHECK: %1 = bitcast float* %ptr to i32*
; CHECK: %2 = load atomic i32, i32* %1 seq_cst, align 4
; CHECK: %3 = bitcast i32 %2 to float
; CHECK: ret float %3
  %res = load atomic float, float* %ptr seq_cst, align 4
  ret float %res
}

define float @float_load_expand_vol(float* %ptr) {
; CHECK-LABEL: @float_load_expand_vol
; CHECK: %1 = bitcast float* %ptr to i32*
; CHECK: %2 = load atomic volatile i32, i32* %1 unordered, align 4
; CHECK: %3 = bitcast i32 %2 to float
; CHECK: ret float %3
  %res = load atomic volatile float, float* %ptr unordered, align 4
  ret float %res
}

define float @float_load_expand_addr1(float addrspace(1)* %ptr) {
; CHECK-LABEL: @float_load_expand_addr1
; CHECK: %1 = bitcast float addrspace(1)* %ptr to i32 addrspace(1)*
; CHECK: %2 = load atomic i32, i32 addrspace(1)* %1 unordered, align 4
; CHECK: %3 = bitcast i32 %2 to float
; CHECK: ret float %3
  %res = load atomic float, float addrspace(1)* %ptr unordered, align 4
  ret float %res
}

define void @float_store_expand(float* %ptr, float %v) {
; CHECK-LABEL: @float_store_expand
; CHECK: %1 = bitcast float %v to i32
; CHECK: %2 = bitcast float* %ptr to i32*
; CHECK: store atomic i32 %1, i32* %2 unordered, align 4
  store atomic float %v, float* %ptr unordered, align 4
  ret void
}

define void @float_store_expand_seq_cst(float* %ptr, float %v) {
; CHECK-LABEL: @float_store_expand_seq_cst
; CHECK: %1 = bitcast float %v to i32
; CHECK: %2 = bitcast float* %ptr to i32*
; CHECK: store atomic i32 %1, i32* %2 seq_cst, align 4
  store atomic float %v, float* %ptr seq_cst, align 4
  ret void
}

define void @float_store_expand_vol(float* %ptr, float %v) {
; CHECK-LABEL: @float_store_expand_vol
; CHECK: %1 = bitcast float %v to i32
; CHECK: %2 = bitcast float* %ptr to i32*
; CHECK: store atomic volatile i32 %1, i32* %2 unordered, align 4
  store atomic volatile float %v, float* %ptr unordered, align 4
  ret void
}

define void @float_store_expand_addr1(float addrspace(1)* %ptr, float %v) {
; CHECK-LABEL: @float_store_expand_addr1
; CHECK: %1 = bitcast float %v to i32
; CHECK: %2 = bitcast float addrspace(1)* %ptr to i32 addrspace(1)*
; CHECK: store atomic i32 %1, i32 addrspace(1)* %2 unordered, align 4
  store atomic float %v, float addrspace(1)* %ptr unordered, align 4
  ret void
}

define void @pointer_cmpxchg_expand(i8** %ptr, i8* %v) {
; CHECK-LABEL: @pointer_cmpxchg_expand
; CHECK: %1 = bitcast i8** %ptr to i64*
; CHECK: %2 = ptrtoint i8* %v to i64
; CHECK: %3 = cmpxchg i64* %1, i64 0, i64 %2 seq_cst monotonic
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8*
; CHECK: %7 = insertvalue { i8*, i1 } undef, i8* %6, 0
; CHECK: %8 = insertvalue { i8*, i1 } %7, i1 %5, 1
  cmpxchg i8** %ptr, i8* null, i8* %v seq_cst monotonic
  ret void
}

define void @pointer_cmpxchg_expand2(i8** %ptr, i8* %v) {
; CHECK-LABEL: @pointer_cmpxchg_expand2
; CHECK: %1 = bitcast i8** %ptr to i64*
; CHECK: %2 = ptrtoint i8* %v to i64
; CHECK: %3 = cmpxchg i64* %1, i64 0, i64 %2 release monotonic
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8*
; CHECK: %7 = insertvalue { i8*, i1 } undef, i8* %6, 0
; CHECK: %8 = insertvalue { i8*, i1 } %7, i1 %5, 1
  cmpxchg i8** %ptr, i8* null, i8* %v release monotonic
  ret void
}

define void @pointer_cmpxchg_expand3(i8** %ptr, i8* %v) {
; CHECK-LABEL: @pointer_cmpxchg_expand3
; CHECK: %1 = bitcast i8** %ptr to i64*
; CHECK: %2 = ptrtoint i8* %v to i64
; CHECK: %3 = cmpxchg i64* %1, i64 0, i64 %2 seq_cst seq_cst
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8*
; CHECK: %7 = insertvalue { i8*, i1 } undef, i8* %6, 0
; CHECK: %8 = insertvalue { i8*, i1 } %7, i1 %5, 1
  cmpxchg i8** %ptr, i8* null, i8* %v seq_cst seq_cst
  ret void
}

define void @pointer_cmpxchg_expand4(i8** %ptr, i8* %v) {
; CHECK-LABEL: @pointer_cmpxchg_expand4
; CHECK: %1 = bitcast i8** %ptr to i64*
; CHECK: %2 = ptrtoint i8* %v to i64
; CHECK: %3 = cmpxchg weak i64* %1, i64 0, i64 %2 seq_cst seq_cst
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8*
; CHECK: %7 = insertvalue { i8*, i1 } undef, i8* %6, 0
; CHECK: %8 = insertvalue { i8*, i1 } %7, i1 %5, 1
  cmpxchg weak i8** %ptr, i8* null, i8* %v seq_cst seq_cst
  ret void
}

define void @pointer_cmpxchg_expand5(i8** %ptr, i8* %v) {
; CHECK-LABEL: @pointer_cmpxchg_expand5
; CHECK: %1 = bitcast i8** %ptr to i64*
; CHECK: %2 = ptrtoint i8* %v to i64
; CHECK: %3 = cmpxchg volatile i64* %1, i64 0, i64 %2 seq_cst seq_cst
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8*
; CHECK: %7 = insertvalue { i8*, i1 } undef, i8* %6, 0
; CHECK: %8 = insertvalue { i8*, i1 } %7, i1 %5, 1
  cmpxchg volatile i8** %ptr, i8* null, i8* %v seq_cst seq_cst
  ret void
}

define void @pointer_cmpxchg_expand6(i8 addrspace(2)* addrspace(1)* %ptr, 
                                     i8 addrspace(2)* %v) {
; CHECK-LABEL: @pointer_cmpxchg_expand6
; CHECK: %1 = bitcast i8 addrspace(2)* addrspace(1)* %ptr to i64 addrspace(1)*
; CHECK: %2 = ptrtoint i8 addrspace(2)* %v to i64
; CHECK: %3 = cmpxchg i64 addrspace(1)* %1, i64 0, i64 %2 seq_cst seq_cst
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8 addrspace(2)*
; CHECK: %7 = insertvalue { i8 addrspace(2)*, i1 } undef, i8 addrspace(2)* %6, 0
; CHECK: %8 = insertvalue { i8 addrspace(2)*, i1 } %7, i1 %5, 1
  cmpxchg i8 addrspace(2)* addrspace(1)* %ptr, i8 addrspace(2)* null, i8 addrspace(2)* %v seq_cst seq_cst
  ret void
}