From: Xionghu Luo <yinyuefengyi@gmail.com>
To: "xionghuluo(罗雄虎)" <xionghuluo@tencent.com>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] if-to-switch: Don't skip the first condition bb when find_conditions in if-to-switch [PR105740]
Date: Tue, 21 Jun 2022 11:44:03 +0800 [thread overview]
Message-ID: <4f1bae53-c9c6-3fd2-126d-d607f3198683@gmail.com> (raw)
In-Reply-To: <tencent_5B86F0F91457C4BE38ACDDAA@qq.com>
Correct the format...
test2:
.LFB0:
.cfi_startproc
xorl %edx, %edx
cmpl $3, (%rdi)
jle .L1
movl 16(%rdi), %eax
cmpl $1, %eax
je .L4
subl $2, %eax
cmpl $4, %eax
ja .L1
movl CSWTCH.1(,%rax,4), %edx
.L1:
movl %edx, %eax
ret
.p2align 4,,10
.p2align 3
.L4:
movl $12, %edx
jmp .L1
.cfi_endproc
.LFE0:
.size test2, .-test2
.section .rodata
.align 16
.type CSWTCH.1, @object
.size CSWTCH.1, 20
CSWTCH.1:
.long 27
.long 38
.long 18
.long 58
.long 68
With the patch attatched:
test2:
.LFB0:
.cfi_startproc
xorl %edx, %edx
cmpl $3, (%rdi)
jle .L1
movl 16(%rdi), %eax
subl $1, %eax
cmpl $5, %eax
jbe .L6
.L1:
movl %edx, %eax
ret
.p2align 4,,10
.p2align 3
.L6:
movl CSWTCH.1(,%rax,4), %edx
movl %edx, %eax
ret
.cfi_endproc
.LFE0:
.size test2, .-test2
.section .rodata
.align 16
.type CSWTCH.1, @object
.size CSWTCH.1, 24
CSWTCH.1:
.long 12
.long 27
.long 38
.long 18
.long 58
.long 68
On 2022/6/21 11:05, xionghuluo(罗雄虎) via Gcc-patches wrote:
> Current GCC generates:
>
>
> test2:
> .LFB0:
> .cfi_startproc
> xorl %edx, %edx
> cmpl $3, (%rdi)
> jle .L1
> movl 16(%rdi), %eax
> cmpl $1, %eax
> je .L4
> subl $2, %eax
> cmpl $4, %eax
> ja .L1
> movl CSWTCH.1(,%rax,4), %edx
> .L1:
> movl %edx, %eax
> ret
> .p2align 4,,10
> .p2align 3
> .L4:
> movl $12, %edx
> jmp .L1
> .cfi_endproc
> .LFE0:
> .size test2, .-test2
> .section .rodata
> .align 16
> .type CSWTCH.1, @object
> .size CSWTCH.1, 20
> CSWTCH.1:
> .long 27
> .long 38
> .long 18
> .long 58
> .long 68
>
>
>
>
> With the patch attatched:
>
>
> test2:
> .LFB0:
> .cfi_startproc
> xorl %edx, %edx
> cmpl $3, (%rdi)
> jle .L1
> movl 16(%rdi), %eax
> subl $1, %eax
> cmpl $5, %eax
> jbe .L6
> .L1:
> movl %edx, %eax
> ret
> .p2align 4,,10
> .p2align 3
> .L6:
> movl CSWTCH.1(,%rax,4), %edx
> movl %edx, %eax
> ret
> .cfi_endproc
> .LFE0:
> .size test2, .-test2
> .section .rodata
> .align 16
> .type CSWTCH.1, @object
> .size CSWTCH.1, 24
> CSWTCH.1:
> .long 12
> .long 27
> .long 38
> .long 18
> .long 58
> .long 68
>
>
> Bootstrap and regression tested pass on x86_64-linux-gnu, OK for master?
next prev parent reply other threads:[~2022-06-21 3:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 3:05 xionghuluo(罗雄虎)
2022-06-21 3:44 ` Xionghu Luo [this message]
2022-06-21 7:28 ` Martin Liška
2022-06-21 7:33 ` Xi Ruoyao
2022-06-21 7:42 ` Martin Liška
2022-06-21 10:08 ` Xionghu Luo
2022-06-21 7:33 ` Richard Biener
2022-06-21 10:05 ` Xionghu Luo
2022-06-21 12:08 ` Richard Biener
2022-06-29 12:01 ` Martin Liška
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=4f1bae53-c9c6-3fd2-126d-d607f3198683@gmail.com \
--to=yinyuefengyi@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=xionghuluo@tencent.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).