Skip to content

Commit 804de61

Browse files
committed
[X86] Cast atomic vectors in IR to support floats
This commit casts floats to ints in an atomic load during AtomicExpand to support floating point types. It also is required to support 128 bit vectors in SSE/AVX.
1 parent 4e9876d commit 804de61

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32136,6 +32136,13 @@ X86TargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const {
3213632136
}
3213732137
}
3213832138

32139+
TargetLowering::AtomicExpansionKind
32140+
X86TargetLowering::shouldCastAtomicLoadInIR(LoadInst *LI) const {
32141+
if (LI->getType()->getScalarType()->isFloatingPointTy())
32142+
return AtomicExpansionKind::CastToInteger;
32143+
return AtomicExpansionKind::None;
32144+
}
32145+
3213932146
LoadInst *
3214032147
X86TargetLowering::lowerIdempotentRMWIntoFencedLoad(AtomicRMWInst *AI) const {
3214132148
unsigned NativeWidth = Subtarget.is64Bit() ? 64 : 32;

llvm/lib/Target/X86/X86ISelLowering.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,8 @@ namespace llvm {
18411841
shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override;
18421842
TargetLoweringBase::AtomicExpansionKind
18431843
shouldExpandLogicAtomicRMWInIR(AtomicRMWInst *AI) const;
1844+
TargetLoweringBase::AtomicExpansionKind
1845+
shouldCastAtomicLoadInIR(LoadInst *LI) const override;
18441846
void emitBitTestAtomicRMWIntrinsic(AtomicRMWInst *AI) const override;
18451847
void emitCmpArithAtomicRMWIntrinsic(AtomicRMWInst *AI) const override;
18461848

0 commit comments

Comments
 (0)