[llvm] r277736 - add tests for missing vector folds
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 4 09:48:31 PDT 2016
Author: spatel
Date: Thu Aug 4 11:48:30 2016
New Revision: 277736
URL: http://llvm.org/viewvc/llvm-project?rev=277736&view=rev
Log:
add tests for missing vector folds
Modified:
llvm/trunk/test/Transforms/InstSimplify/compare.ll
Modified: llvm/trunk/test/Transforms/InstSimplify/compare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/compare.ll?rev=277736&r1=277735&r2=277736&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/compare.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/compare.ll Thu Aug 4 11:48:30 2016
@@ -1005,22 +1005,46 @@ define i1 @nonnull_load_as_inner(i32 add
; If a bit is known to be zero for A and known to be one for B,
; then A and B cannot be equal.
-define i1 @icmp_eq_const(i32 %a) nounwind {
+define i1 @icmp_eq_const(i32 %a) {
+; CHECK-LABEL: @icmp_eq_const(
+; CHECK-NEXT: ret i1 false
+;
%b = mul nsw i32 %a, -2
%c = icmp eq i32 %b, 1
ret i1 %c
+}
-; CHECK-LABEL: @icmp_eq_const
-; CHECK-NEXT: ret i1 false
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @icmp_eq_const_vec(<2 x i32> %a) {
+; CHECK-LABEL: @icmp_eq_const_vec(
+; CHECK-NEXT: [[B:%.*]] = mul nsw <2 x i32> %a, <i32 -2, i32 -2>
+; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[B]], <i32 1, i32 1>
+; CHECK-NEXT: ret <2 x i1> [[C]]
+;
+ %b = mul nsw <2 x i32> %a, <i32 -2, i32 -2>
+ %c = icmp eq <2 x i32> %b, <i32 1, i32 1>
+ ret <2 x i1> %c
}
-define i1 @icmp_ne_const(i32 %a) nounwind {
+define i1 @icmp_ne_const(i32 %a) {
+; CHECK-LABEL: @icmp_ne_const(
+; CHECK-NEXT: ret i1 true
+;
%b = mul nsw i32 %a, -2
%c = icmp ne i32 %b, 1
ret i1 %c
+}
-; CHECK-LABEL: @icmp_ne_const
-; CHECK-NEXT: ret i1 true
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @icmp_ne_const_vec(<2 x i32> %a) {
+; CHECK-LABEL: @icmp_ne_const_vec(
+; CHECK-NEXT: [[B:%.*]] = mul nsw <2 x i32> %a, <i32 -2, i32 -2>
+; CHECK-NEXT: [[C:%.*]] = icmp ne <2 x i32> [[B]], <i32 1, i32 1>
+; CHECK-NEXT: ret <2 x i1> [[C]]
+;
+ %b = mul nsw <2 x i32> %a, <i32 -2, i32 -2>
+ %c = icmp ne <2 x i32> %b, <i32 1, i32 1>
+ ret <2 x i1> %c
}
define i1 @icmp_sdiv_int_min(i32 %a) {
More information about the llvm-commits
mailing list