[llvm] r281219 - [InstCombine] add tests to show missing vector folds
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 08:51:42 PDT 2016
Author: spatel
Date: Mon Sep 12 10:51:42 2016
New Revision: 281219
URL: http://llvm.org/viewvc/llvm-project?rev=281219&view=rev
Log:
[InstCombine] add tests to show missing vector folds
Modified:
llvm/trunk/test/Transforms/InstCombine/exact.ll
llvm/trunk/test/Transforms/InstCombine/shift.ll
Modified: llvm/trunk/test/Transforms/InstCombine/exact.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/exact.ll?rev=281219&r1=281218&r2=281219&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/exact.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/exact.ll Mon Sep 12 10:51:42 2016
@@ -132,7 +132,7 @@ define <2 x i1> @ashr_icmp2_vec(<2 x i64
; PR9998
; Make sure we don't transform the ashr here into an sdiv
-define i1 @pr9998(i32 %V) nounwind {
+define i1 @pr9998(i32 %V) {
; CHECK-LABEL: @pr9998(
; CHECK-NEXT: [[W_MASK:%.*]] = and i32 %V, 1
; CHECK-NEXT: [[Z:%.*]] = icmp ne i32 [[W_MASK]], 0
@@ -145,6 +145,22 @@ define i1 @pr9998(i32 %V) nounwind {
ret i1 %Z
}
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @pr9998vec(<2 x i32> %V) {
+; CHECK-LABEL: @pr9998vec(
+; CHECK-NEXT: [[W:%.*]] = shl <2 x i32> %V, <i32 31, i32 31>
+; CHECK-NEXT: [[X:%.*]] = ashr exact <2 x i32> [[W]], <i32 31, i32 31>
+; CHECK-NEXT: [[Y:%.*]] = sext <2 x i32> [[X]] to <2 x i64>
+; CHECK-NEXT: [[Z:%.*]] = icmp ugt <2 x i64> [[Y]], <i64 7297771788697658747, i64 7297771788697658747>
+; CHECK-NEXT: ret <2 x i1> [[Z]]
+;
+ %W = shl <2 x i32> %V, <i32 31, i32 31>
+ %X = ashr exact <2 x i32> %W, <i32 31, i32 31>
+ %Y = sext <2 x i32> %X to <2 x i64>
+ %Z = icmp ugt <2 x i64> %Y, <i64 7297771788697658747, i64 7297771788697658747>
+ ret <2 x i1> %Z
+}
+
define i1 @udiv_icmp1(i64 %X) {
; CHECK-LABEL: @udiv_icmp1(
; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i64 %X, 0
Modified: llvm/trunk/test/Transforms/InstCombine/shift.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/shift.ll?rev=281219&r1=281218&r2=281219&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/shift.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/shift.ll Mon Sep 12 10:51:42 2016
@@ -628,6 +628,18 @@ define i1 @test35(i32 %X) {
ret i1 %tmp2
}
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test35vec(<2 x i32> %X) {
+; CHECK-LABEL: @test35vec(
+; CHECK-NEXT: [[TMP1:%.*]] = ashr <2 x i32> %X, <i32 7, i32 7>
+; CHECK-NEXT: [[TMP2:%.*]] = icmp slt <2 x i32> [[TMP1]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[TMP2]]
+;
+ %tmp1 = ashr <2 x i32> %X, <i32 7, i32 7>
+ %tmp2 = icmp slt <2 x i32> %tmp1, zeroinitializer
+ ret <2 x i1> %tmp2
+}
+
define i128 @test36(i128 %A, i128 %B) {
; CHECK-LABEL: @test36(
; CHECK-NEXT: entry:
More information about the llvm-commits
mailing list