[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
Thu Nov 21 05:35:10 PST 2013


Thanks for the review. I've committed it to the trunk in r195355 and I'll commit it to release_34 soon.

I'll follow up with a more general patch in the next week or two.

> -----Original Message-----
> From: Owen Anderson [mailto:resistor at mac.com]
> Sent: 21 November 2013 07:23
> To: Daniel Sanders
> Cc: llvm-commits at cs.uiuc.edu; Akira Hatanaka;
> reviews+D2229+public+53507b020c3f642e at llvm-reviews.chandlerc.com
> Subject: Re: [PATCH] Add support for legalizing SETNE/SETEQ by inverting the
> condition code and the result of the comparison.
> 
> Hi Daniel,
> 
> This patch looks good to me.  I agree with Akira's assessment about
> extending the support to cover other comparison codes, as well, as his
> hesitation to perform that change on the release branch without a
> motivating testcase.  I'd suggest applying this patch as is, and then
> developing a follow-on to generalize it.
> 
> --Owen
> 
> On Nov 20, 2013, at 4:49 AM, Daniel Sanders <Daniel.Sanders at imgtec.com>
> wrote:
> 
> > 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