[PATCH] Add support for legalizing SETNE/SETEQ by inverting the condition code and the result of the comparison.

Daniel Sanders Daniel.Sanders at imgtec.com
Wed Nov 20 04:49:03 PST 2013


Hi Owen,

I've added you as a reviewer since I'd like to put this on the release branch and I understand that you are the code owner for this area.

In our internal review, Akira Hatanaka suggested adding support for inverting additional condition codes using ISD::getSetCCInverse(). I'm in agreement with this for the trunk but I'm not sure if it should be done for the release branch. The assertion I'm trying to fix is only triggered by a SETNE. Would you prefer me to change the patch to support all relevant conditions or stick to the current one that only fixes the assertion?

> -----Original Message-----
> From: Daniel Sanders [mailto:daniel.sanders at imgtec.com]
> Sent: 20 November 2013 11:54
> To: resistor at mac.com; Daniel Sanders
> Cc: llvm-commits at cs.uiuc.edu
> Subject: [PATCH] Add support for legalizing SETNE/SETEQ by inverting the
> condition code and the result of the comparison.
> 
> Hi resistor,
> 
> LegalizeSetCCCondCode can now legalize SETEQ and SETNE by returning the
> inverse condition and requesting that the caller invert the result of the
> condition.
> 
> The caller of LegalizeSetCCCondCode must handle the inverted CC, and they
> do so as follows:
>   SETCC, BR_CC:
>     Invert the result of the SETCC with SelectionDAG::getNOT()
>   SELECT_CC:
>     Swap the true/false operands.
> 
> This is necessary for MSA which lacks an integer SETNE instruction.
> 
> http://llvm-reviews.chandlerc.com/D2229
> 
> Files:
>   lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
>   test/CodeGen/Mips/msa/compare.ll
>   test/CodeGen/Mips/msa/llvm-stress-s3861334421.ll




More information about the llvm-commits mailing list