[PATCH] D51145: make copyFMF consistent with AnyDefined for detection of any FMF flag set to true
Michael Berg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 11 14:18:49 PDT 2018
mcberg2017 updated this revision to Diff 164970.
mcberg2017 added a comment.
Collapsed for single version...
https://reviews.llvm.org/D51145
Files:
include/llvm/IR/Operator.h
test/CodeGen/X86/intersect-fma-fmf.ll
Index: test/CodeGen/X86/intersect-fma-fmf.ll
===================================================================
--- test/CodeGen/X86/intersect-fma-fmf.ll
+++ test/CodeGen/X86/intersect-fma-fmf.ll
@@ -3,8 +3,7 @@
define float @test_x86_fma_intersection_fmf(float %a, float %b) {
; CHECK-LABEL: test_x86_fma_intersection_fmf:
; CHECK: # %bb.0:
-; CHECK: vmulss {{[0-9]+}}(%esp), %xmm0, %xmm1
-; CHECK-NEXT: vaddss %xmm0, %xmm1, %xmm0
+; CHECK: vfmadd132ss {{[0-9]+}}(%esp), %xmm0, %xmm0
; CHECK: retl
%tmp8 = fmul fast float %a, %b
%tmp9 = fadd fast float %tmp8, %b
Index: include/llvm/IR/Operator.h
===================================================================
--- include/llvm/IR/Operator.h
+++ include/llvm/IR/Operator.h
@@ -364,19 +364,26 @@
/// precision.
float getFPAccuracy() const;
- static bool classof(const Instruction *I) {
- return I->getType()->isFPOrFPVectorTy() ||
- I->getOpcode() == Instruction::FCmp;
- }
-
- static bool classof(const ConstantExpr *CE) {
- return CE->getType()->isFPOrFPVectorTy() ||
- CE->getOpcode() == Instruction::FCmp;
- }
-
static bool classof(const Value *V) {
- return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
- (isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)));
+ unsigned Opcode;
+ if (auto *I = dyn_cast<Instruction>(V))
+ Opcode = I->getOpcode();
+ else if (auto *CE = dyn_cast<ConstantExpr>(V))
+ Opcode = CE->getOpcode();
+ else
+ return false;
+
+ switch (Opcode) {
+ case Instruction::FCmp:
+ return true;
+ // non math FP Operators (no FMF)
+ case Instruction::ExtractElement:
+ case Instruction::ShuffleVector:
+ case Instruction::InsertElement:
+ return false;
+ default:
+ return V->getType()->isFPOrFPVectorTy();
+ }
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51145.164970.patch
Type: text/x-patch
Size: 1874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180911/97ac3123/attachment.bin>
More information about the llvm-commits
mailing list