diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-10-28 04:01:09 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-10-28 04:01:09 +0000 |
commit | 402b6783735a8d4470831133b1df2c98349509d2 (patch) | |
tree | 3d22e6aba4b9785216105fb308cdc88c8ac3b7a3 /lib | |
parent | d9c8822fb308862ea0d4df06c1c7df8fd38d4f1d (diff) | |
download | external_llvm-402b6783735a8d4470831133b1df2c98349509d2.zip external_llvm-402b6783735a8d4470831133b1df2c98349509d2.tar.gz external_llvm-402b6783735a8d4470831133b1df2c98349509d2.tar.bz2 |
New entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43420 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/X86/README.txt | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt index 41b38d8..567d5c4 100644 --- a/lib/Target/X86/README.txt +++ b/lib/Target/X86/README.txt @@ -1429,3 +1429,65 @@ Possible optimizations: + } + } //===---------------------------------------------------------------------===// + +main () +{ + int i = 0; + unsigned long int z = 0; + + do { + z -= 0x00004000; + i++; + if (i > 0x00040000) + abort (); + } while (z > 0); + exit (0); +} + +gcc compiles this to: + +_main: + subl $28, %esp + xorl %eax, %eax + jmp L2 +L3: + cmpl $262144, %eax + je L10 +L2: + addl $1, %eax + cmpl $262145, %eax + jne L3 + call L_abort$stub +L10: + movl $0, (%esp) + call L_exit$stub + +llvm: + +_main: + subl $12, %esp + movl $1, %eax + movl $16384, %ecx +LBB1_1: # bb + cmpl $262145, %eax + jge LBB1_4 # cond_true +LBB1_2: # cond_next + incl %eax + addl $4294950912, %ecx + cmpl $16384, %ecx + jne LBB1_1 # bb +LBB1_3: # bb11 + xorl %eax, %eax + addl $12, %esp + ret +LBB1_4: # cond_true + call L_abort$stub + +1. LSR should rewrite the first cmp with induction variable %ecx. +2. DAG combiner should fold + leal 1(%eax), %edx + cmpl $262145, %edx + => + cmpl $262144, %eax + +//===---------------------------------------------------------------------===// |