diff options
author | Bill Wendling <isanbard@gmail.com> | 2009-10-27 23:30:07 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2009-10-27 23:30:07 +0000 |
commit | f9e2226cbaa0b634728b3a7a47acd1c11440fccc (patch) | |
tree | 14aefdbd1751e5e5a7a781a70b360e472dc21c02 | |
parent | 472ebdd60175b884d8ea2f1e77a73bcbe5a9136c (diff) | |
download | external_llvm-f9e2226cbaa0b634728b3a7a47acd1c11440fccc.zip external_llvm-f9e2226cbaa0b634728b3a7a47acd1c11440fccc.tar.gz external_llvm-f9e2226cbaa0b634728b3a7a47acd1c11440fccc.tar.bz2 |
Add new note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85341 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/README.txt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt index 794eaa9..a345d3d 100644 --- a/lib/Target/README.txt +++ b/lib/Target/README.txt @@ -1633,3 +1633,38 @@ This can be generalized for other forms: b = (b & ~0x80) | (a & 0x40) << 1; //===---------------------------------------------------------------------===// + +These two functions produce different code. They shouldn't: + +#include <stdint.h> + +uint8_t p1(uint8_t b, uint8_t a) { + b = (b & ~0xc0) | (a & 0xc0); + return (b); +} + +uint8_t p2(uint8_t b, uint8_t a) { + b = (b & ~0x40) | (a & 0x40); + b = (b & ~0x80) | (a & 0x80); + return (b); +} + +define zeroext i8 @p1(i8 zeroext %b, i8 zeroext %a) nounwind readnone ssp { +entry: + %0 = and i8 %b, 63 ; <i8> [#uses=1] + %1 = and i8 %a, -64 ; <i8> [#uses=1] + %2 = or i8 %1, %0 ; <i8> [#uses=1] + ret i8 %2 +} + +define zeroext i8 @p2(i8 zeroext %b, i8 zeroext %a) nounwind readnone ssp { +entry: + %0 = and i8 %b, 63 ; <i8> [#uses=1] + %.masked = and i8 %a, 64 ; <i8> [#uses=1] + %1 = and i8 %a, -128 ; <i8> [#uses=1] + %2 = or i8 %1, %0 ; <i8> [#uses=1] + %3 = or i8 %2, %.masked ; <i8> [#uses=1] + ret i8 %3 +} + +//===---------------------------------------------------------------------===// |