[PowerPC] add tests for PR30661
authorSanjay Patel <spatel@rotateright.com>
Fri, 14 Oct 2016 20:51:41 +0000 (20:51 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 14 Oct 2016 20:51:41 +0000 (20:51 +0000)
llvm-svn: 284279

llvm/test/CodeGen/PowerPC/negate-i1.ll [new file with mode: 0644]

diff --git a/llvm/test/CodeGen/PowerPC/negate-i1.ll b/llvm/test/CodeGen/PowerPC/negate-i1.ll
new file mode 100644 (file)
index 0000000..17cf82d
--- /dev/null
@@ -0,0 +1,26 @@
+; RUN: llc < %s -mtriple=powerpc64-apple-darwin | FileCheck %s
+
+; PR30661 - https://llvm.org/bugs/show_bug.cgi?id=30661
+
+define i32 @select_i32_neg1_or_0(i1 %a) {
+; CHECK-LABEL: select_i32_neg1_or_0:
+; CHECK:       ; BB#0:
+; CHECK-NEXT:    sldi r2, r3, 63
+; CHECK-NEXT:    sradi r3, r2, 63
+; CHECK-NEXT:    blr
+;
+  %b = sext i1 %a to i32
+  ret i32 %b
+}
+
+define i32 @select_i32_neg1_or_0_zeroext(i1 zeroext %a) {
+; CHECK-LABEL: select_i32_neg1_or_0_zeroext:
+; CHECK:       ; BB#0:
+; CHECK-NEXT:    sldi r2, r3, 63
+; CHECK-NEXT:    sradi r3, r2, 63
+; CHECK-NEXT:    blr
+;
+  %b = sext i1 %a to i32
+  ret i32 %b
+}
+