summaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM
diff options
context:
space:
mode:
authorStephen Lin <stephenwlin@gmail.com>2013-04-23 19:42:25 +0000
committerStephen Lin <stephenwlin@gmail.com>2013-04-23 19:42:25 +0000
commit81fef0267b6971b32a618a655d91f472cedfcaf2 (patch)
treee67ebe560ecf171d06b59d4a3ac47ef3e853f303 /test/CodeGen/ARM
parenta0840c4b820f0e946f96cbd56cadccd7d2c83c87 (diff)
downloadllvm-81fef0267b6971b32a618a655d91f472cedfcaf2.tar.gz
llvm-81fef0267b6971b32a618a655d91f472cedfcaf2.tar.bz2
llvm-81fef0267b6971b32a618a655d91f472cedfcaf2.tar.xz
Add more tests for r179925 to verify correct handling of signext/zeroext; strengthen condition check to require actual MVT::i32 virtual register types, just in case (no actual functionality change)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180138 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM')
-rw-r--r--test/CodeGen/ARM/this-return.ll64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/this-return.ll b/test/CodeGen/ARM/this-return.ll
index f06e4a4f8d..3047302ea7 100644
--- a/test/CodeGen/ARM/this-return.ll
+++ b/test/CodeGen/ARM/this-return.ll
@@ -103,3 +103,67 @@ entry:
%call2 = tail call %struct.B* @B_ctor_complete(%struct.B* %b2, i32 %x)
ret %struct.E* %this
}
+
+declare i16 @identity16(i16 returned %x)
+declare zeroext i16 @zeroext16(i16 returned %x)
+declare i32 @identity32(i32 returned %x)
+
+define i16 @test_identity(i16 %x) {
+entry:
+; CHECKELF: test_identity:
+; CHECKELF: mov [[SAVEX:r[0-9]+]], r0
+; CHECKELF: bl identity16
+; CHECKELF: uxth r0, [[SAVEX]]
+; CHECKELF: bl identity32
+; CHECKELF: mov r0, [[SAVEX]]
+; CHECKT2D: test_identity:
+; CHECKT2D: mov [[SAVEX:r[0-9]+]], r0
+; CHECKT2D: blx _identity16
+; CHECKT2D: uxth r0, [[SAVEX]]
+; CHECKT2D: blx _identity32
+; CHECKT2D: mov r0, [[SAVEX]]
+ %call = tail call i16 @identity16(i16 %x)
+ %b = zext i16 %x to i32
+ %call2 = tail call i32 @identity32(i32 %b)
+ ret i16 %call
+}
+
+define i16 @test_matched_ext(i16 %x) {
+entry:
+; CHECKELF: test_matched_ext:
+; CHECKELF-NOT: mov {{r[0-9]+}}, r0
+; CHECKELF: bl zeroext16
+; CHECKELF-NOT: uxth r0, {{r[0-9]+}}
+; CHECKELF: bl identity32
+; CHECKELF-NOT: mov r0, {{r[0-9]+}}
+; CHECKT2D: test_matched_ext:
+; CHECKT2D-NOT: mov {{r[0-9]+}}, r0
+; CHECKT2D: blx _zeroext16
+; CHECKT2D-NOT: uxth r0, {{r[0-9]+}}
+; CHECKT2D: blx _identity32
+; CHECKT2D-NOT: mov r0, {{r[0-9]+}}
+ %call = tail call i16 @zeroext16(i16 %x)
+ %b = zext i16 %call to i32
+ %call2 = tail call i32 @identity32(i32 %b)
+ ret i16 %call
+}
+
+define i16 @test_mismatched_ext(i16 %x) {
+entry:
+; CHECKELF: test_mismatched_ext:
+; CHECKELF: mov [[SAVEX:r[0-9]+]], r0
+; CHECKELF: bl zeroext16
+; CHECKELF: sxth r0, [[SAVEX]]
+; CHECKELF: bl identity32
+; CHECKELF: mov r0, [[SAVEX]]
+; CHECKT2D: test_mismatched_ext:
+; CHECKT2D: mov [[SAVEX:r[0-9]+]], r0
+; CHECKT2D: blx _zeroext16
+; CHECKT2D: sxth r0, [[SAVEX]]
+; CHECKT2D: blx _identity32
+; CHECKT2D: mov r0, [[SAVEX]]
+ %call = tail call i16 @zeroext16(i16 %x)
+ %b = sext i16 %call to i32
+ %call2 = tail call i32 @identity32(i32 %b)
+ ret i16 %call
+}