[PATCH] D47425: [GlobalISel][Legalizer] Fix i1s being sign extended instead of zero-extended

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 29 15:43:01 PDT 2018


efriedma added a comment.

If possible, GlobalISel's handling of booleans should match SelectionDAG's handling:

1. Legalization for ISD::STORE always zero-extends integers which are not byte-sized (see SelectionDAGLegalize::LegalizeStoreOps).
2. getBooleanContents() specifies the extension of the result of various arithmetic operations which produce and consume "boolean" values; on the producing side, SETCC/SADDO/etc., and on the consuming side, SELECT/BRCOND/ADDCARRY/etc.  This is documented in ISDOpcodes.
3. i1 values produced by operations which are not boolean operations don't need to have any particular kind of extension.

The third rule is arguably weird, but it avoids scattering special cases for i1 across legalization. I don't see any compelling reason for GlobalISel to diverge.

The ABI rule for booleans on AArch64 is a little strange. The value must be passed/returned as if it were converted to unsigned char, but it doesn't need to be zero-extended beyond 8 bits.  (See examples at https://bugs.llvm.org/show_bug.cgi?id=36719 .)  This should be handled somewhere in the ABI code, not legalization.


Repository:
  rL LLVM

https://reviews.llvm.org/D47425





More information about the llvm-commits mailing list