Changes in directory llvm/lib/Target/X86:
README.txt updated: 1.127 -> 1.128 --- Log message: Testcase noticed from PR906: http://llvm.org/PR906 --- Diffs of the changes: (+34 -0) README.txt | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.127 llvm/lib/Target/X86/README.txt:1.128 --- llvm/lib/Target/X86/README.txt:1.127 Mon Sep 11 17:57:51 2006 +++ llvm/lib/Target/X86/README.txt Mon Sep 11 18:00:56 2006 @@ -594,3 +594,37 @@ 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. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits