Skip to content

[X86] znver missing cmpxchg8b feature, resulting in expanded atomicrmw #42280

@nikic

Description

@nikic
Bugzilla Link 42935
Resolution FIXED
Resolved on Aug 09, 2019 02:56
Version 9.0
OS All
Blocks #41819
CC @topperc,@zmodem,@RKSimon,@rotateright
Fixed by commit(s) r368324

Extended Description

define i64 @​test(i64* %p) {
%x = atomicrmw sub i64* %p, i64 1 seq_cst
ret i64 %x
}

Under -mcpu=znver1 results in:

pushq	%rax
.cfi_def_cfa_offset 16
movl	$1, %esi
movl	$5, %edx
callq	__atomic_fetch_sub_8
popq	%rcx
.cfi_def_cfa_offset 8
retq

While it should produce a "lock xaddq" instruction.

This issue was introduced in https://reviews.llvm.org/D59576, where the CMPXCHG8B feature flag was not added to ZNFeatures.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions