[PATCH] D59119: [SelectionDAG] Check legality for ADDCARRY in expandMUL_LOHI

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 13:31:15 PDT 2019


leonardchan added a comment.

In D59119#1424657 <https://reviews.llvm.org/D59119#1424657>, @efriedma wrote:

> I'm not sure what you're hoping to accomplish with this change.  Even on targets where i64 ADDCARRY isn't legal, we have code to expand it (see DAGTypeLegalizer::ExpandIntRes_ADDSUBCARRY etc.), and it's still generally cheap.


Sorry for the delay. Was addressing something else for a bit.

The intention of this was to address an error when compiling for sparc where we get this error during ISEL selection:

  LLVM ERROR: Cannot select: t42: i32,i32 = addcarry t41:1, Constant:i32<0>, t90:1

Reproducable from

  $ bin/llc < ../llvm-project-3/llvm/test/CodeGen/X86/smul_fix.ll -mtriple=sparc

I don't remember why I talk about X86 since this should have nothing to do with this, but for sparc at least I imagine we shouldn't have this error be raised.

ADDCARRY doesn't seem to get processed through `ExpandIntRes_ADDSUBCARRY()` (according to the debug dump), but it does try to get handled by `ExpandNode()` which doesn't have a case for ADDCARRY and fails to expand it. Is the correct way to approach this just to add an ADDCARRY case to `ExpandNode()`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59119/new/

https://reviews.llvm.org/D59119





More information about the llvm-commits mailing list