summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/cast.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-01 16:13:43 +0000
committerChris Lattner <sabre@nondot.org>2005-01-01 16:13:43 +0000
commit296fcbaf2c0079916f10c10b53effbba6db3096c (patch)
tree31e8ff311688bc1e2f1e478d47ec919c9d0ed752 /test/Transforms/InstCombine/cast.ll
parente768ff2cdca504c42b5bf1ab9c7c57b54be381a3 (diff)
downloadllvm-296fcbaf2c0079916f10c10b53effbba6db3096c.tar.gz
llvm-296fcbaf2c0079916f10c10b53effbba6db3096c.tar.bz2
llvm-296fcbaf2c0079916f10c10b53effbba6db3096c.tar.xz
Add a bunch of tests for cases that should be eliminated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/cast.ll')
-rw-r--r--test/Transforms/InstCombine/cast.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll
index f0b99568f4..bf7d405059 100644
--- a/test/Transforms/InstCombine/cast.ll
+++ b/test/Transforms/InstCombine/cast.ll
@@ -128,3 +128,30 @@ bool %test20(bool %B) {
%D = setlt int %C, -1
ret bool %D ;; false
}
+
+uint %test21(uint %X) {
+ %Y = cast uint %X to sbyte
+ %Z = cast sbyte %Y to uint ;; sext -> zext -> and -> nop
+ %RV = and uint %Z, 255
+ ret uint %RV
+}
+
+uint %test22(uint %X) {
+ %Y = cast uint %X to sbyte
+ %Z = cast sbyte %Y to uint ;; sext -> zext -> and -> nop
+ %RV = shl uint %Z, ubyte 24
+ ret uint %RV
+}
+
+int %test23(int %X) {
+ %Y = cast int %X to ushort ;; Turn into an AND even though X
+ %Z = cast ushort %Y to int ;; and Z are signed.
+ ret int %Z
+}
+
+bool %test24(bool %C) {
+ %X = select bool %C, uint 14, uint 1234
+ %Y = cast uint %X to bool ;; Fold cast into select
+ ret bool %Y
+}
+