Skip to content

Commit e3a53ab

Browse files
committed
Don't use aarch64 hint for arm targets
1 parent 25830d6 commit e3a53ab

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

stdlib/public/Synchronization/Mutex/SpinLoopHint.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ var _tries: Int {
1717
100
1818
}
1919

20+
#if arch(arm)
21+
2022
// The following are acceptable operands to the aarch64 hint intrinsic from
2123
// 'llvm-project/llvm/lib/Target/ARM/ARMInstrInfo.td':
2224
//
@@ -28,9 +30,27 @@ var _tries: Int {
2830
// `sevl` = 5
2931
//
3032
// There are others, but for the sake of spin loops, we only care about 'wfe'.
33+
@_extern(c, "llvm.arm.hint")
34+
func _hint(_: UInt32)
35+
36+
#else
37+
38+
// The following are acceptable operands to the aarch64 hint intrinsic from
39+
// 'llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.td':
40+
//
41+
// `nop` = 0
42+
// `yield` = 1
43+
// `wfe` = 2
44+
// `wfi` = 3
45+
// `sev` = 4
46+
// `sevl` = 5
47+
//
48+
// There are others, but for the sake of spin loops, we only care about 'wfe'.
3149
@_extern(c, "llvm.aarch64.hint")
3250
func _hint(_: UInt32)
3351

52+
#endif
53+
3454
@inline(__always)
3555
func _wfe() {
3656
_hint(2)

0 commit comments

Comments
 (0)