[PATCH] D25485: [DAG] optimize negation of bool

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 17 11:08:48 PDT 2016


spatel added a comment.

In https://reviews.llvm.org/D25485#570870, @spatel wrote:

> There's an extra 'negu' in the MIPS select test. I didn't check to see what is going on there.


This isn't extra. The existing CHECK lines don't include the sll/sra pair, so this is actually a win, not a regression.

Before:

  mtc1	$5, $f1
  mtc1	$6, $f2
  sltu	$1, $zero, $4
  sll	$1, $1, 31
  sra	$1, $1, 31
  mtc1	$1, $f0
  jr	 $ra
  sel.s	$f0, $f2, $f1

After:

  sltu	$1, $zero, $4
  negu	 $1, $1   <--- the 'and' mask was folded away, so we saved an instruction
  mtc1	$5, $f1
  mtc1	$6, $f2
  mtc1	$1, $f0
  jr	 $ra
  sel.s	$f0, $f2, $f1

> Based on the earlier comments, I think we're ok with an added instruction in the microMIPS cases as long as there's a reduction in the code size.

@sdardis / @dsanders : do you see any common folds that are missing based on the MIPS diffs? I don't think you want me trying any MIPS-specific hacks, so if there's a net win already, we should be ok to proceed?


https://reviews.llvm.org/D25485





More information about the llvm-commits mailing list