[PATCH, i386]: Unify TImode shifts handling with DImode
Uros Bizjak
ubizjak@gmail.com
Fri Jun 27 20:55:00 GMT 2008
Hello!
Attached patch unifies TImode shift infrastructure with DImode
infrastructure. Patched gcc generates slightly better code, i.e. TImode
variable shifts now generate:
.LFB2:
movl %edx, %ecx
movq %rsi, %rdx
movq %rdi, %rax
shldq %rdi, %rdx
salq %cl, %rax
xorl %esi, %esi
testb $64, %cl
cmovne %rax, %rdx
pushq %rbp
.LCFI0:
cmovne %rsi, %rax
popq %rbp
ret
vs.
testti:
.LFB2:
movl %edx, %ecx
movq %rsi, %rdx
movq %rdi, %rax
shldq %rdi, %rdx
salq %cl, %rax
movq %rbx, -16(%rsp)
.LCFI0:
xorl %ebx, %ebx
andl $64, %ecx
movq %rbp, -8(%rsp)
.LCFI1:
movq -8(%rsp), %rbp
cmovne %rax, %rdx
cmovne %rbx, %rax
movq -16(%rsp), %rbx
ret
Patch also includes a couple of cleanups, it introduces
const_1_to_63_operand operand predicate for DImode constant shifts in
addition to simplification of operand constraints and alternatives for
SImode and DImode double shifts.
2008-06-27 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (ashlti3, ashrti3, lshrti3): Expand using
ix86_expand_binary_operator directly.
(*ashlti3_1): Rename from ashlti3_1. Use nonmemory_operand predicate
for operand 2.
(*ashrti3_1): Ditto.
(*lshrti3_1): Ditto.
(*ashlti3_2, *ashrti3_2, *lshrti3_2): Remove insn patterns.
(ashlti, ashrti and lshrti splitters): Handle nonmemory operand 2
using only one splitter. Conditionaly execute splitter before or
after peephole2 pass.
(ashlti, ashrti and lshrti peephole2): Define peephole2 patterns.
(x86_shld): Rename from x86_shld_1. Compress operand 2 constraints.
Use only one alternative in asm template.
(x86_64_shld): Compress operand 2 constraints. Use only one alternative
in asm template.
(*ashldi3_cmp_rex64): Use const_1_to_63_operand operand predicate and
"J" operand constraint for operand 2.
(*ashldi3_cconly_rex64): Ditto.
(*ashrdi3_cmp_rex64): Ditto.
(*ashrdi3_cconly_rex64): Ditto.
(*lshrdi3_cmp_rex64): Ditto.
(*lshrdi3_cconly_rex64): Ditto.
* config/i386/predicates.md (const_1_to_63_operand): New predicate.
* config/i386/i386.md (print_operand) ['s']: Print ", " using fputs.
(split_ashr, split_ashl, split_lshr): Use gen_x86_shrd instead of
gen_x86_shrd_1.
Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
{,-m32}. Patch is committed to SVN.
Uros.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080627/cbc452ce/attachment.txt>
More information about the Gcc-patches
mailing list