diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-04-06 17:19:35 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-04-06 17:19:35 +0000 |
commit | 8617897aaa71381c9a9f6d51b117d0d6e217cfe3 (patch) | |
tree | 398efd904d7af6234614dea3bdd095f5e6ac0c75 /lib/Target/X86/README.txt | |
parent | f3480a80153da1029ae56ccb6c1b1936afa71870 (diff) | |
download | external_llvm-8617897aaa71381c9a9f6d51b117d0d6e217cfe3.zip external_llvm-8617897aaa71381c9a9f6d51b117d0d6e217cfe3.tar.gz external_llvm-8617897aaa71381c9a9f6d51b117d0d6e217cfe3.tar.bz2 |
The original issue has been fixed by not doing unnecessary sign extensions.
Change the test to force a sign extension and expose the problem again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/README.txt')
-rw-r--r-- | lib/Target/X86/README.txt | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt index 77a513d..b339e89 100644 --- a/lib/Target/X86/README.txt +++ b/lib/Target/X86/README.txt @@ -1656,23 +1656,26 @@ information to add the "lock" prefix. //===---------------------------------------------------------------------===// -_Bool bar(int *x) { return *x & 1; } +struct B { + unsigned char y0 : 1; +}; -define zeroext i1 @bar(i32* nocapture %x) nounwind readonly { -entry: - %tmp1 = load i32* %x ; <i32> [#uses=1] - %and = and i32 %tmp1, 1 ; <i32> [#uses=1] - %tobool = icmp ne i32 %and, 0 ; <i1> [#uses=1] - ret i1 %tobool +int bar(struct B* a) { return a->y0; } + +define i32 @bar(%struct.B* nocapture %a) nounwind readonly optsize { + %1 = getelementptr inbounds %struct.B* %a, i64 0, i32 0 + %2 = load i8* %1, align 1 + %3 = and i8 %2, 1 + %4 = zext i8 %3 to i32 + ret i32 %4 } -bar: # @bar -# BB#0: # %entry - movl 4(%esp), %eax - movb (%eax), %al - andb $1, %al - movzbl %al, %eax - ret +bar: # @bar +# BB#0: + movb (%rdi), %al + andb $1, %al + movzbl %al, %eax + ret Missed optimization: should be movl+andl. |