Skip to content

Commit 3887953

Browse files
dpaoliellosivadeilra
authored andcommitted
Apply 0030-lse-intrinsics.patch
1 parent b810f6f commit 3887953

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

clang/lib/Headers/arm64intr.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,18 @@ unsigned __int64 __swp64(unsigned __int64 volatile * _Target, unsigned __int64 _
7676
unsigned __int8 __swpa8(unsigned __int8 volatile * _Target, unsigned __int8 _Value);
7777
unsigned __int16 __swpa16(unsigned __int16 volatile * _Target, unsigned __int16 _Value);
7878
unsigned __int32 __swpa32(unsigned __int32 volatile * _Target, unsigned __int32 _Value);
79-
unsigned __int64 __swpa64(unsigned __int64 volatile * _Target, unsigned __int64 _Value);
79+
80+
static inline unsigned __int64 __swpa64(unsigned __int64 volatile * _Target, unsigned __int64 _Value)
81+
{
82+
unsigned __int64 _Previous;
83+
84+
__asm__ __volatile__("swpa %[Value], %[Previous], %[Target]"
85+
: [Previous] "=r"(_Previous), [Target] "+m"(*_Target)
86+
: [Value] "r"(_Value)
87+
);
88+
return _Previous;
89+
}
90+
8091
unsigned __int8 __swpl8(unsigned __int8 volatile * _Target, unsigned __int8 _Value);
8192
unsigned __int16 __swpl16(unsigned __int16 volatile * _Target, unsigned __int16 _Value);
8293
unsigned __int32 __swpl32(unsigned __int32 volatile * _Target, unsigned __int32 _Value);
@@ -93,7 +104,16 @@ unsigned __int64 __cas64(unsigned __int64 volatile * _Target, unsigned __int64 _
93104
unsigned __int8 __casa8(unsigned __int8 volatile * _Target, unsigned __int8 _Comp, unsigned __int8 _Value);
94105
unsigned __int16 __casa16(unsigned __int16 volatile * _Target, unsigned __int16 _Comp, unsigned __int16 _Value);
95106
unsigned __int32 __casa32(unsigned __int32 volatile * _Target, unsigned __int32 _Comp, unsigned __int32 _Value);
96-
unsigned __int64 __casa64(unsigned __int64 volatile * _Target, unsigned __int64 _Comp, unsigned __int64 _Value);
107+
108+
static inline unsigned __int64 __casa64(unsigned __int64 volatile * _Target, unsigned __int64 _Comp, unsigned __int64 _Value)
109+
{
110+
__asm__ __volatile__("casa %[Comp], %[Value], %[Target]"
111+
: [Comp] "+r"(_Comp), [Target] "+m"(*_Target)
112+
: [Value] "r"(_Value)
113+
);
114+
return _Comp;
115+
}
116+
97117
unsigned __int8 __casl8(unsigned __int8 volatile * _Target, unsigned __int8 _Comp, unsigned __int8 _Value);
98118
unsigned __int16 __casl16(unsigned __int16 volatile * _Target, unsigned __int16 _Comp, unsigned __int16 _Value);
99119
unsigned __int32 __casl32(unsigned __int32 volatile * _Target, unsigned __int32 _Comp, unsigned __int32 _Value);

0 commit comments

Comments
 (0)