[llvm-commits] [llvm] r130338 - in /llvm/trunk: include/llvm/CodeGen/FastISel.h lib/CodeGen/SelectionDAG/FastISel.cpp lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/fast-isel-x86-64.ll

Frits van Bommel fvbommel at gmail.com
Thu Apr 28 01:21:15 PDT 2011


On Thu, Apr 28, 2011 at 12:41 AM, Eli Friedman <eli.friedman at gmail.com> wrote:
> +  virtual unsigned TargetMaterializeFloatZero(const ConstantFP* CF) {
> +    return 0;
> +  }

> getRegForValue(Constant::getNullValue(TD.getIntPtrType(V->getContext())));
>   } else if (const ConstantFP *CF = dyn_cast<ConstantFP>(V)) {
> -    // Try to emit the constant directly.
> -    Reg = FastEmit_f(VT, VT, ISD::ConstantFP, CF);
> +    if (CF->isZero()) {
> +      Reg = TargetMaterializeFloatZero(CF);
> +    } else {
> +      // Try to emit the constant directly.
> +      Reg = FastEmit_f(VT, VT, ISD::ConstantFP, CF);
> +    }

This doesn't seem to handle the case where FastEmit_f() would work but
TargetMaterializeFloatZero() isn't overridden, which would be the
"obvious" way to implement a target that doesn't need to handle 0.0
specially.
IMHO, this should either try TargetMaterializeFloatZero() first and
fall back to FastEmit_f if it returns 0, or the default
TargetMaterializeFloatZero() implementation should be changed to call
FastEmit_f().




More information about the llvm-commits mailing list