|
| 1 | + |
1 | 2 | for (ityp,jtyp) ∈ [("i8", UInt8), ("i16", UInt16), ("i32", UInt32), ("i64", UInt64), ("i128", UInt128)] |
2 | 3 | @eval begin |
3 | 4 | @inline function _atomic_load(ptr::Ptr{$jtyp}) |
4 | 5 | Base.llvmcall($(""" |
5 | | - %p = inttoptr i$(8sizeof(Int)) %0 to $(ityp)* |
6 | | - %v = load atomic $(ityp), $(ityp)* %p acquire, align $(Base.gc_alignment(jtyp)) |
| 6 | + %v = load atomic $(ityp), ptr %0 acquire, align $(Base.gc_alignment(jtyp)) |
7 | 7 | ret $(ityp) %v |
8 | 8 | """), $jtyp, Tuple{Ptr{$jtyp}}, ptr) |
9 | 9 | end |
10 | 10 | @inline function _atomic_store!(ptr::Ptr{$jtyp}, x::$jtyp) |
11 | 11 | Base.llvmcall($(""" |
12 | | - %p = inttoptr i$(8sizeof(Int)) %0 to $(ityp)* |
13 | | - store atomic $(ityp) %1, $(ityp)* %p release, align $(Base.gc_alignment(jtyp)) |
| 12 | + store atomic $(ityp) %1, ptr %0 release, align $(Base.gc_alignment(jtyp)) |
14 | 13 | ret void |
15 | 14 | """), Cvoid, Tuple{Ptr{$jtyp}, $jtyp}, ptr, x) |
16 | 15 | end |
17 | 16 | @inline function _atomic_cas_cmp!(ptr::Ptr{$jtyp}, cmp::$jtyp, newval::$jtyp) |
18 | 17 | Base.llvmcall($(""" |
19 | | - %p = inttoptr i$(8sizeof(Int)) %0 to $(ityp)* |
20 | | - %c = cmpxchg $(ityp)* %p, $(ityp) %1, $(ityp) %2 acq_rel acquire |
| 18 | + %c = cmpxchg ptr %0, $(ityp) %1, $(ityp) %2 acq_rel acquire |
21 | 19 | %bit = extractvalue { $ityp, i1 } %c, 1 |
22 | 20 | %bool = zext i1 %bit to i8 |
23 | 21 | ret i8 %bool |
|
0 commit comments