diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-04-06 17:35:32 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-04-06 17:35:32 +0000 |
commit | 3d195faaade44335021e4cd1f6fe1bef7cc34961 (patch) | |
tree | f507523d68a33bd4a01f00972fd712c8eefaf536 | |
parent | 8617897aaa71381c9a9f6d51b117d0d6e217cfe3 (diff) |
Add another case we are not optimizing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129012 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/README.txt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt index b339e89e5a..1ac2305e82 100644 --- a/lib/Target/X86/README.txt +++ b/lib/Target/X86/README.txt @@ -1681,6 +1681,36 @@ Missed optimization: should be movl+andl. //===---------------------------------------------------------------------===// +The x86_64 abi says: + +Booleans, when stored in a memory object, are stored as single byte objects the +value of which is always 0 (false) or 1 (true). + +We are not using this fact: + +int bar(_Bool *a) { return *a; } + +define i32 @bar(i8* nocapture %a) nounwind readonly optsize { + %1 = load i8* %a, align 1, !tbaa !0 + %tmp = and i8 %1, 1 + %2 = zext i8 %tmp to i32 + ret i32 %2 +} + +bar: + movb (%rdi), %al + andb $1, %al + movzbl %al, %eax + ret + +GCC produces + +bar: + movzbl (%rdi), %eax + ret + +//===---------------------------------------------------------------------===// + Consider the following two functions compiled with clang: _Bool foo(int *x) { return !(*x & 4); } unsigned bar(int *x) { return !(*x & 4); } |