mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-04 03:06:28 +00:00
Transforms: lower fadd and fsub atomicrmw instructions
`fadd` and `fsub` have recently (r351850) been added as `atomicrmw` operations. This diff adds lowering cases for them to the LowerAtomic transform. Patch by Josh Berdine! llvm-svn: 361512
This commit is contained in:
parent
d18dde10f1
commit
0d19bba33e
@ -86,6 +86,12 @@ static bool LowerAtomicRMWInst(AtomicRMWInst *RMWI) {
|
||||
Res = Builder.CreateSelect(Builder.CreateICmpULT(Orig, Val),
|
||||
Orig, Val);
|
||||
break;
|
||||
case AtomicRMWInst::FAdd:
|
||||
Res = Builder.CreateFAdd(Orig, Val);
|
||||
break;
|
||||
case AtomicRMWInst::FSub:
|
||||
Res = Builder.CreateFSub(Orig, Val);
|
||||
break;
|
||||
}
|
||||
Builder.CreateStore(Res, Ptr);
|
||||
RMWI->replaceAllUsesWith(Orig);
|
||||
|
@ -35,3 +35,25 @@ define i8 @min() {
|
||||
ret i8 %j
|
||||
; CHECK: ret i8 [[INST]]
|
||||
}
|
||||
|
||||
define float @fadd() {
|
||||
; CHECK-LABEL: @fadd(
|
||||
%i = alloca float
|
||||
%j = atomicrmw fadd float* %i, float 42.0 monotonic
|
||||
; CHECK: [[INST:%[a-z0-9]+]] = load
|
||||
; CHECK-NEXT: fadd
|
||||
; CHECK-NEXT: store
|
||||
ret float %j
|
||||
; CHECK: ret float [[INST]]
|
||||
}
|
||||
|
||||
define float @fsub() {
|
||||
; CHECK-LABEL: @fsub(
|
||||
%i = alloca float
|
||||
%j = atomicrmw fsub float* %i, float 42.0 monotonic
|
||||
; CHECK: [[INST:%[a-z0-9]+]] = load
|
||||
; CHECK-NEXT: fsub
|
||||
; CHECK-NEXT: store
|
||||
ret float %j
|
||||
; CHECK: ret float [[INST]]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user