diff options
author | Chris Lattner <sabre@nondot.org> | 2010-09-19 00:37:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-09-19 00:37:34 +0000 |
commit | 313a94c3d0bf0f0a6e0f8083d09f2fb3add9753f (patch) | |
tree | 2e0656cc8f6f443de528dda6fe5ddfdbe5926c42 | |
parent | 702917d4e836ec8346c05aadbc2c1a461c6c3ca6 (diff) | |
download | llvm-313a94c3d0bf0f0a6e0f8083d09f2fb3add9753f.tar.gz llvm-313a94c3d0bf0f0a6e0f8083d09f2fb3add9753f.tar.bz2 llvm-313a94c3d0bf0f0a6e0f8083d09f2fb3add9753f.tar.xz |
idiom recognition should catch this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114304 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/README.txt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt index 4faf8bcfd4..32e7385d23 100644 --- a/lib/Target/README.txt +++ b/lib/Target/README.txt @@ -2,6 +2,38 @@ Target Independent Opportunities: //===---------------------------------------------------------------------===// +We should recognize idioms for add-with-carry and turn it into the appropriate +intrinsics. This example: + +unsigned add32carry(unsigned sum, unsigned x) { + unsigned z = sum + x; + if (sum + x < x) + z++; + return z; +} + +Compiles to: clang t.c -S -o - -O3 -fomit-frame-pointer -m64 -mkernel + +_add32carry: ## @add32carry + addl %esi, %edi + cmpl %esi, %edi + sbbl %eax, %eax + andl $1, %eax + addl %edi, %eax + ret + +with clang, but to: + +_add32carry: + leal (%rsi,%rdi), %eax + cmpl %esi, %eax + adcl $0, %eax + ret + +with gcc. + +//===---------------------------------------------------------------------===// + Dead argument elimination should be enhanced to handle cases when an argument is dead to an externally visible function. Though the argument can't be removed from the externally visible function, the caller doesn't need to pass it in. |