[WebAssembly] Implement isCheapToSpeculateCtlz and isCheapToSpeculateCttz.
authorDan Gohman <dan433584@gmail.com>
Thu, 19 Nov 2015 23:04:59 +0000 (23:04 +0000)
committerDan Gohman <dan433584@gmail.com>
Thu, 19 Nov 2015 23:04:59 +0000 (23:04 +0000)
This unbreaks test/CodeGen/WebAssembly/i32.ll and
test/CodeGen/WebAssembly/i64.ll after r224899.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253617 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
lib/Target/WebAssembly/WebAssemblyISelLowering.h

index bae4f526723ec2d254ff0948852664d66a98cd15..dbfe00e95ed005c0401fb0ca68bc1418de2c8fb7 100644 (file)
@@ -228,6 +228,16 @@ WebAssemblyTargetLowering::getRegForInlineAsmConstraint(
   return TargetLowering::getRegForInlineAsmConstraint(TRI, Constraint, VT);
 }
 
+bool WebAssemblyTargetLowering::isCheapToSpeculateCttz() const {
+  // Assume ctz is a relatively cheap operation.
+  return true;
+}
+
+bool WebAssemblyTargetLowering::isCheapToSpeculateCtlz() const {
+  // Assume clz is a relatively cheap operation.
+  return true;
+}
+
 //===----------------------------------------------------------------------===//
 // WebAssembly Lowering private implementation.
 //===----------------------------------------------------------------------===//
index c79ffb29c25285952adca2c87a410c2f27048fe1..3621571151a1941bcb0981bccbf55e061744b6ef 100644 (file)
@@ -52,6 +52,8 @@ private:
   std::pair<unsigned, const TargetRegisterClass *>
   getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
                                StringRef Constraint, MVT VT) const override;
+  bool isCheapToSpeculateCttz() const override;
+  bool isCheapToSpeculateCtlz() const override;
 
   SDValue LowerCall(CallLoweringInfo &CLI,
                     SmallVectorImpl<SDValue> &InVals) const override;