diff options
author | Chris Lattner <sabre@nondot.org> | 2006-09-11 23:00:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-09-11 23:00:56 +0000 |
commit | 8b4de218d93f225b74b1a74591283cd24c0686b9 (patch) | |
tree | b455665fa1707f13397a8fb7523485c03d471a7c /llvm/lib/Target | |
parent | 6e7286f72a5bc85b9fd303d5dd5c443ec54667a5 (diff) | |
download | bcm5719-llvm-8b4de218d93f225b74b1a74591283cd24c0686b9.tar.gz bcm5719-llvm-8b4de218d93f225b74b1a74591283cd24c0686b9.zip |
Testcase noticed from PR906
llvm-svn: 30269
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/X86/README.txt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/README.txt b/llvm/lib/Target/X86/README.txt index 98b58539f5a..394201c3c19 100644 --- a/llvm/lib/Target/X86/README.txt +++ b/llvm/lib/Target/X86/README.txt @@ -594,3 +594,37 @@ or eax, 2 cmp eax, 6 jz label +//===---------------------------------------------------------------------===// + +Compile: +int %test(ulong *%tmp) { + %tmp = load ulong* %tmp ; <ulong> [#uses=1] + %tmp.mask = shr ulong %tmp, ubyte 50 ; <ulong> [#uses=1] + %tmp.mask = cast ulong %tmp.mask to ubyte ; <ubyte> [#uses=1] + %tmp2 = and ubyte %tmp.mask, 3 ; <ubyte> [#uses=1] + %tmp2 = cast ubyte %tmp2 to int ; <int> [#uses=1] + ret int %tmp2 +} + +to: + +_test: + movl 4(%esp), %eax + movl 4(%eax), %eax + shrl $18, %eax + andl $3, %eax + ret + +instead of: + +_test: + movl 4(%esp), %eax + movl 4(%eax), %eax + shrl $18, %eax + # TRUNCATE movb %al, %al + andb $3, %al + movzbl %al, %eax + ret + +This saves a movzbl, and saves a truncate if it doesn't get coallesced right. +This is a simple DAGCombine to propagate the zext through the and. |