[PATCH] D48467: [X86] Recognize a splat of negate in isFNEG

Easwaran Raman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 13:58:18 PDT 2018


eraman added inline comments.


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:36852
+      if (auto *C = cast_or_null<ConstantFP>(
+              getTargetConstantFromNode(Op1.getOperand(0))))
+        if (IsNeg(C))
----------------
RKSimon wrote:
> Are there any circumstances that this isn't a ConstantFP? getTargetConstantFromNode peeks through bitcasts so don't you need to use dyn_cast_or_null?
I have changed it to dyn_cast_or_null, but thinking about it I don't think that is needed.  First, the current code reads 

if (Op1.getOpcode() == X86ISD::VBROADCAST) {
    if (auto *C = getTargetConstantFromNode(Op1.getOperand(0)))
      if (isSignMask(cast<ConstantFP>(C)))

The x86 vbroadcast instruction broadcasts floating point values, so I think the cast<ConstantFP> is right. 


Repository:
  rL LLVM

https://reviews.llvm.org/D48467





More information about the llvm-commits mailing list