mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Error out on CodeGen of unaligned load/store. Fix test so it isn't accidentally testing that case.
llvm-svn: 139641
This commit is contained in:
parent
d0121fe635
commit
f13b5ef0e1
@ -3402,6 +3402,9 @@ void SelectionDAGBuilder::visitAtomicLoad(const LoadInst &I) {
|
||||
|
||||
EVT VT = EVT::getEVT(I.getType());
|
||||
|
||||
if (I.getAlignment() * 8 != VT.getSizeInBits())
|
||||
report_fatal_error("Cannot generate unaligned atomic load");
|
||||
|
||||
SDValue L =
|
||||
DAG.getAtomic(ISD::ATOMIC_LOAD, dl, VT, VT, InChain,
|
||||
getValue(I.getPointerOperand()),
|
||||
@ -3427,13 +3430,17 @@ void SelectionDAGBuilder::visitAtomicStore(const StoreInst &I) {
|
||||
|
||||
SDValue InChain = getRoot();
|
||||
|
||||
EVT VT = EVT::getEVT(I.getValueOperand()->getType());
|
||||
|
||||
if (I.getAlignment() * 8 != VT.getSizeInBits())
|
||||
report_fatal_error("Cannot generate unaligned atomic store");
|
||||
|
||||
if (TLI.getInsertFencesForAtomic())
|
||||
InChain = InsertFenceForAtomic(InChain, Order, Scope, true, dl,
|
||||
DAG, TLI);
|
||||
|
||||
SDValue OutChain =
|
||||
DAG.getAtomic(ISD::ATOMIC_STORE, dl,
|
||||
getValue(I.getValueOperand()).getValueType().getSimpleVT(),
|
||||
DAG.getAtomic(ISD::ATOMIC_STORE, dl, VT,
|
||||
InChain,
|
||||
getValue(I.getPointerOperand()),
|
||||
getValue(I.getValueOperand()),
|
||||
|
@ -7,13 +7,13 @@ define void @test1(i64* %ptr, i64 %val1) {
|
||||
; CHECK: test1
|
||||
; CHECK: cmpxchg8b
|
||||
; CHECK-NEXT: jne
|
||||
store atomic i64 %val1, i64* %ptr seq_cst, align 4
|
||||
store atomic i64 %val1, i64* %ptr seq_cst, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
define i64 @test2(i64* %ptr) {
|
||||
; CHECK: test2
|
||||
; CHECK: cmpxchg8b
|
||||
%val = load atomic i64* %ptr seq_cst, align 4
|
||||
%val = load atomic i64* %ptr seq_cst, align 8
|
||||
ret i64 %val
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user