mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
SelectionDAG: accommodate atomic floating stores.
We were applying a pointer truncation to floating types, which crashed LLVM. That is Not A Good Thing(TM). llvm-svn: 360421
This commit is contained in:
parent
e23fb5e721
commit
f99745ac17
@ -4717,7 +4717,10 @@ void SelectionDAGBuilder::visitAtomicStore(const StoreInst &I) {
|
||||
MemVT.getStoreSize(), I.getAlignment(), AAMDNodes(),
|
||||
nullptr, SSID, Ordering);
|
||||
|
||||
SDValue Val = DAG.getPtrExtOrTrunc(getValue(I.getValueOperand()), dl, MemVT);
|
||||
SDValue Val = getValue(I.getValueOperand());
|
||||
if (Val.getValueType() != MemVT)
|
||||
Val = DAG.getPtrExtOrTrunc(Val, dl, MemVT);
|
||||
|
||||
SDValue OutChain = DAG.getAtomic(ISD::ATOMIC_STORE, dl, MemVT, InChain,
|
||||
getValue(I.getPointerOperand()), Val, MMO);
|
||||
|
||||
|
@ -59,7 +59,7 @@ define void @volatile(i8* %a, i16* %b, i32* %c, i64* %d) local_unnamed_addr {
|
||||
}
|
||||
|
||||
; CHECK-LABEL: monotonic
|
||||
define void @monotonic(i8* %a, i16* %b, i32* %c, i64* %d) local_unnamed_addr {
|
||||
define void @monotonic(i8* %a, i16* %b, i32* %c, i64* %d, float* %e) local_unnamed_addr {
|
||||
; CHECK: ld.volatile.u8 %rs{{[0-9]+}}, [%rd{{[0-9]+}}]
|
||||
%a.load = load atomic i8, i8* %a monotonic, align 1
|
||||
%a.add = add i8 %a.load, 1
|
||||
@ -84,5 +84,11 @@ define void @monotonic(i8* %a, i16* %b, i32* %c, i64* %d) local_unnamed_addr {
|
||||
; CHECK: st.volatile.u64 [%rd{{[0-9]+}}], %rd{{[0-9]+}}
|
||||
store atomic i64 %d.add, i64* %d monotonic, align 8
|
||||
|
||||
; CHECK: ld.volatile.f32 %f{{[0-9]+}}, [%rd{{[0-9]+}}]
|
||||
%e.load = load atomic float, float* %e monotonic, align 4
|
||||
%e.add = fadd float %e.load, 1.0
|
||||
; CHECK: st.volatile.f32 [%rd{{[0-9]+}}], %f{{[0-9]+}}
|
||||
store atomic float %e.add, float* %e monotonic, align 4
|
||||
|
||||
ret void
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user