diff options
author | Chris Lattner <sabre@nondot.org> | 2005-09-24 23:42:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-09-24 23:42:18 +0000 |
commit | 8a11da021bce9a3971333b12b7c35965b4e24303 (patch) | |
tree | a737869330fac189ad1b9c79a4c5bdf35543486c /test | |
parent | a58ef7b6526ee30f4793fe91686899c602b4f9b9 (diff) | |
download | external_llvm-8a11da021bce9a3971333b12b7c35965b4e24303.zip external_llvm-8a11da021bce9a3971333b12b7c35965b4e24303.tar.gz external_llvm-8a11da021bce9a3971333b12b7c35965b4e24303.tar.bz2 |
All of these should turn into sign extends (e.g. extsh/extsb on PPC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/signext.ll | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/signext.ll b/test/Transforms/InstCombine/signext.ll new file mode 100644 index 0000000..a3b4982 --- /dev/null +++ b/test/Transforms/InstCombine/signext.ll @@ -0,0 +1,43 @@ +; RUN: llvm-as < %s | opt -instcombine -disable-output && +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep '(and\|xor\|add\|shl\|shr)' + +int %test1(int %x) { + %tmp.1 = and int %x, 65535 ; <int> [#uses=1] + %tmp.2 = xor int %tmp.1, -32768 ; <int> [#uses=1] + %tmp.3 = add int %tmp.2, 32768 ; <int> [#uses=1] + ret int %tmp.3 +} + +int %test2(int %x) { + %tmp.1 = and int %x, 65535 ; <int> [#uses=1] + %tmp.2 = xor int %tmp.1, 32768 ; <int> [#uses=1] + %tmp.3 = add int %tmp.2, -32768 ; <int> [#uses=1] + ret int %tmp.3 +} + +int %test3(ushort %P) { + %tmp.1 = cast ushort %P to int ; <int> [#uses=1] + %tmp.4 = xor int %tmp.1, 32768 ; <int> [#uses=1] + %tmp.5 = add int %tmp.4, -32768 ; <int> [#uses=1] + ret int %tmp.5 +} + +uint %test4(ushort %P) { + %tmp.1 = cast ushort %P to uint ; <uint> [#uses=1] + %tmp.4 = xor uint %tmp.1, 32768 ; <uint> [#uses=1] + %tmp.5 = add uint %tmp.4, 4294934528 ; <uint> [#uses=1] + ret uint %tmp.5 +} + +int %test5(int %x) { + %tmp.1 = and int %x, 254 + %tmp.2 = xor int %tmp.1, 128 + %tmp.3 = add int %tmp.2, -128 + ret int %tmp.3 +} + +int %test6(int %x) { + %tmp.2 = shl int %x, ubyte 16 ; <int> [#uses=1] + %tmp.4 = shr int %tmp.2, ubyte 16 ; <int> [#uses=1] + ret int %tmp.4 +} |