summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/sar_fold64.ll
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:46:15 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:46:15 +0000
commitdd58ef019b700900793a1eb48b52123db01b654e (patch)
treefcfbb4df56a744f4ddc6122c50521dd3f1c5e196 /test/CodeGen/X86/sar_fold64.ll
parent2fe5752e3a7c345cdb59e869278d36af33c13fa4 (diff)
downloadsrc-test-dd58ef019b700900793a1eb48b52123db01b654e.tar.gz
src-test-dd58ef019b700900793a1eb48b52123db01b654e.zip
Notes
Diffstat (limited to 'test/CodeGen/X86/sar_fold64.ll')
-rw-r--r--test/CodeGen/X86/sar_fold64.ll43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/CodeGen/X86/sar_fold64.ll b/test/CodeGen/X86/sar_fold64.ll
new file mode 100644
index 0000000000000..7b33bb8c06169
--- /dev/null
+++ b/test/CodeGen/X86/sar_fold64.ll
@@ -0,0 +1,43 @@
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
+
+define i32 @shl48sar47(i64 %a) #0 {
+; CHECK-LABEL: shl48sar47:
+; CHECK: # BB#0:
+; CHECK-NEXT: movswq %di, %rax
+ %1 = shl i64 %a, 48
+ %2 = ashr exact i64 %1, 47
+ %3 = trunc i64 %2 to i32
+ ret i32 %3
+}
+
+define i32 @shl48sar49(i64 %a) #0 {
+; CHECK-LABEL: shl48sar49:
+; CHECK: # BB#0:
+; CHECK-NEXT: movswq %di, %rax
+ %1 = shl i64 %a, 48
+ %2 = ashr exact i64 %1, 49
+ %3 = trunc i64 %2 to i32
+ ret i32 %3
+}
+
+define i32 @shl56sar55(i64 %a) #0 {
+; CHECK-LABEL: shl56sar55:
+; CHECK: # BB#0:
+; CHECK-NEXT: movsbq %dil, %rax
+ %1 = shl i64 %a, 56
+ %2 = ashr exact i64 %1, 55
+ %3 = trunc i64 %2 to i32
+ ret i32 %3
+}
+
+define i32 @shl56sar57(i64 %a) #0 {
+; CHECK-LABEL: shl56sar57:
+; CHECK: # BB#0:
+; CHECK-NEXT: movsbq %dil, %rax
+ %1 = shl i64 %a, 56
+ %2 = ashr exact i64 %1, 57
+ %3 = trunc i64 %2 to i32
+ ret i32 %3
+}
+
+attributes #0 = { nounwind }