public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <andrew.pinski@caviumnetworks.com>
To: Steve Ellcey <sellcey@mips.com>
Cc: gcc-patches@gcc.gnu.org, rguenther@suse.de
Subject: Re: [patch] Performance patch for MIPS conditional move in expr.c
Date: Wed, 14 Nov 2012 21:51:00 -0000	[thread overview]
Message-ID: <CA+=Sn1n6RTs4GpMF-h_Hj5XP3mDqSghHyfSYZZ_WmWzQxCFxUQ@mail.gmail.com> (raw)
In-Reply-To: <1352929552.22862.13.camel@ubuntu-sellcey>

[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]

On Wed, Nov 14, 2012 at 1:45 PM, Steve Ellcey <sellcey@mips.com> wrote:
> On Wed, 2012-11-14 at 12:00 -0800, Andrew Pinski wrote:
>
>> I know exactly where this code comes from; I have looked at the
>> benchmark as one of the reason why I add expand_cond_expr_using_cmove
>> in the first place.  Anyways you should look into removing
>> TARGET_PROMOTE_PROTOTYPES because I found that also fixes the problem
>> mentioned here.
>>
>> Thanks,
>> Andrew Pinski
>
> Removing TARGET_PROMOTE_PROTOTYPES looks interesting but I don't know if
> it is possible for compatibility reasons.  I am still looking at my
> example though, I see GCC doing:
>
> andi    $5,$5,0x1
> xori    $5,$5,0x1
> movz    $2,$4,$5
>
> When it should just do:
>
> andi    $5,$5,0x1
> movn    $2,$4,$5

Yes I have a few patches for improving this case.  I have not
submitted them yet though.
Attached is the assembly I get from a 4.7 toolchain with all of the
changes I have internally applied; this is for n32 (though o32
produces the exact same code in this case).  I will try to post some
more in the next coming weeks.

Thanks,
Andrew Pinski


>
>
> Steve Ellcey
> sellcey@mips.com
>
>

[-- Attachment #2: n32.s --]
[-- Type: application/octet-stream, Size: 1655 bytes --]

	.file	1 "t5.c"
	.section .mdebug.abiN32
	.previous
	.gnu_attribute 4, 3
	.abicalls
	.option	pic0
	.text
	.align	2
	.align	3
	.globl	foo
.LFB0 = .
	.cfi_startproc
	.set	nomips16
	.ent	foo
	.type	foo, @function
foo:
	.frame	$sp,0,$31		# vars= 0, regs= 0/0, args= 0, gp= 0
	.mask	0x00000000,0
	.fmask	0x00000000,0
	.set	noreorder
	.set	nomacro
	xori	$3,$5,0x2006
	xor	$6,$5,$4
	srl	$7,$3,1
	srl	$2,$5,1
	ori	$8,$7,0x8800
	andi	$5,$6,0x1
	andi	$9,$2,0x77ff
	srl	$4,$4,1
	movn	$9,$8,$5
	srl	$10,$4,1
	srl	$11,$10,1
	xori	$12,$9,0x2006
	xor	$13,$9,$4
	srl	$14,$12,1
	srl	$15,$9,1
	andi	$24,$13,0x1
	ori	$25,$14,0x8800
	andi	$6,$15,0x77ff
	srl	$5,$11,1
	movn	$6,$25,$24
	srl	$4,$5,1
	srl	$3,$4,1
	xori	$2,$6,0x2006
	xor	$7,$6,$10
	srl	$8,$2,1
	srl	$10,$6,1
	andi	$12,$7,0x1
	ori	$9,$8,0x8800
	andi	$13,$10,0x77ff
	srl	$14,$3,1
	movn	$13,$9,$12
	xori	$15,$13,0x2006
	xor	$11,$13,$11
	srl	$24,$15,1
	srl	$25,$13,1
	andi	$6,$11,0x1
	ori	$7,$24,0x8800
	andi	$2,$25,0x77ff
	movn	$2,$7,$6
	xori	$8,$2,0x2006
	xor	$5,$2,$5
	srl	$10,$8,1
	srl	$12,$2,1
	andi	$9,$5,0x1
	ori	$13,$10,0x8800
	andi	$15,$12,0x77ff
	movn	$15,$13,$9
	xori	$11,$15,0x2006
	xor	$4,$15,$4
	srl	$24,$11,1
	srl	$25,$15,1
	andi	$6,$4,0x1
	ori	$7,$24,0x8800
	andi	$2,$25,0x77ff
	movn	$2,$7,$6
	xori	$8,$2,0x2006
	xor	$3,$2,$3
	srl	$10,$2,1
	srl	$5,$8,1
	andi	$12,$3,0x1
	ori	$9,$5,0x8800
	andi	$13,$10,0x77ff
	movn	$13,$9,$12
	xori	$15,$13,0x2006
	xor	$14,$13,$14
	srl	$11,$15,1
	srl	$24,$13,1
	andi	$25,$14,0x1
	ori	$4,$11,0x8800
	andi	$2,$24,0x77ff
	j	$31
	movn	$2,$4,$25

	.set	macro
	.set	reorder
	.end	foo
	.cfi_endproc
.LFE0:
	.size	foo, .-foo
	.ident	"GCC: (Cavium Development Version) 4.7.0"

  reply	other threads:[~2012-11-14 21:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 19:02 Steve Ellcey 
2012-11-14 19:15 ` Andrew Pinski
2012-11-14 19:27   ` Steve Ellcey
2012-11-14 20:01     ` Andrew Pinski
2012-11-14 21:46       ` Steve Ellcey
2012-11-14 21:51         ` Andrew Pinski [this message]
2012-11-14 22:22           ` Andrew Pinski
2012-11-15 20:59             ` Richard Sandiford
2012-11-15 21:24               ` Andrew Pinski
2012-11-15 21:39                 ` Andrew Pinski
2013-01-07 21:39                   ` Steve Ellcey
2013-03-07 15:12             ` Jakub Jelinek
2013-03-07 16:01               ` Andrew Pinski
2012-11-15  1:51 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+=Sn1n6RTs4GpMF-h_Hj5XP3mDqSghHyfSYZZ_WmWzQxCFxUQ@mail.gmail.com' \
    --to=andrew.pinski@caviumnetworks.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    --cc=sellcey@mips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).