[llvm] r274460 - add vector bool select tests and regenerate checks for scalar bool select tests
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 3 06:26:02 PDT 2016
Author: spatel
Date: Sun Jul 3 08:26:02 2016
New Revision: 274460
URL: http://llvm.org/viewvc/llvm-project?rev=274460&view=rev
Log:
add vector bool select tests and regenerate checks for scalar bool select tests
Modified:
llvm/trunk/test/Transforms/InstCombine/select.ll
Modified: llvm/trunk/test/Transforms/InstCombine/select.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select.ll?rev=274460&r1=274459&r2=274460&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/select.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/select.ll Sun Jul 3 08:26:02 2016
@@ -1,5 +1,5 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
-; This test makes sure that these instructions are properly eliminated.
+
; PR1822
target datalayout = "e-p:64:64-p1:16:16-p2:32:32:32-p3:64:64:64"
@@ -54,41 +54,157 @@ define i32 @test6(i1 %C) {
}
define i1 @test7(i1 %C, i1 %X) {
- ; R = or C, X
- %R = select i1 %C, i1 true, i1 %X
- ret i1 %R
; CHECK-LABEL: @test7(
-; CHECK: %R = or i1 %C, %X
-; CHECK: ret i1 %R
+; CHECK-NEXT: [[R:%.*]] = or i1 %C, %X
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %R = select i1 %C, i1 true, i1 %X
+ ret i1 %R
+}
+
+define <2 x i1> @test7vec(<2 x i1> %C, <2 x i1> %X) {
+; CHECK-LABEL: @test7vec(
+; CHECK-NEXT: [[R:%.*]] = select <2 x i1> %C, <2 x i1> <i1 true, i1 true>, <2 x i1> %X
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %R = select <2 x i1> %C, <2 x i1> <i1 true, i1 true>, <2 x i1> %X
+ ret <2 x i1> %R
}
define i1 @test8(i1 %C, i1 %X) {
- ; R = and C, X
- %R = select i1 %C, i1 %X, i1 false
- ret i1 %R
; CHECK-LABEL: @test8(
-; CHECK: %R = and i1 %C, %X
-; CHECK: ret i1 %R
+; CHECK-NEXT: [[R:%.*]] = and i1 %C, %X
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %R = select i1 %C, i1 %X, i1 false
+ ret i1 %R
+}
+
+define <2 x i1> @test8vec(<2 x i1> %C, <2 x i1> %X) {
+; CHECK-LABEL: @test8vec(
+; CHECK-NEXT: [[R:%.*]] = select <2 x i1> %C, <2 x i1> %X, <2 x i1> zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %R = select <2 x i1> %C, <2 x i1> %X, <2 x i1> <i1 false, i1 false>
+ ret <2 x i1> %R
}
define i1 @test9(i1 %C, i1 %X) {
- ; R = and !C, X
- %R = select i1 %C, i1 false, i1 %X
- ret i1 %R
; CHECK-LABEL: @test9(
-; CHECK: xor i1 %C, true
-; CHECK: %R = and i1
-; CHECK: ret i1 %R
+; CHECK-NEXT: [[NOT_C:%.*]] = xor i1 %C, true
+; CHECK-NEXT: [[R:%.*]] = and i1 [[NOT_C]], %X
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %R = select i1 %C, i1 false, i1 %X
+ ret i1 %R
+}
+
+define <2 x i1> @test9vec(<2 x i1> %C, <2 x i1> %X) {
+; CHECK-LABEL: @test9vec(
+; CHECK-NEXT: [[R:%.*]] = select <2 x i1> %C, <2 x i1> zeroinitializer, <2 x i1> %X
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %R = select <2 x i1> %C, <2 x i1> <i1 false, i1 false>, <2 x i1> %X
+ ret <2 x i1> %R
}
define i1 @test10(i1 %C, i1 %X) {
- ; R = or !C, X
- %R = select i1 %C, i1 %X, i1 true
- ret i1 %R
; CHECK-LABEL: @test10(
-; CHECK: xor i1 %C, true
-; CHECK: %R = or i1
-; CHECK: ret i1 %R
+; CHECK-NEXT: [[NOT_C:%.*]] = xor i1 %C, true
+; CHECK-NEXT: [[R:%.*]] = or i1 [[NOT_C]], %X
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %R = select i1 %C, i1 %X, i1 true
+ ret i1 %R
+}
+
+define <2 x i1> @test10vec(<2 x i1> %C, <2 x i1> %X) {
+; CHECK-LABEL: @test10vec(
+; CHECK-NEXT: [[R:%.*]] = select <2 x i1> %C, <2 x i1> %X, <2 x i1> <i1 true, i1 true>
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %R = select <2 x i1> %C, <2 x i1> %X, <2 x i1> <i1 true, i1 true>
+ ret <2 x i1> %R
+}
+
+define i1 @test23(i1 %a, i1 %b) {
+; CHECK-LABEL: @test23(
+; CHECK-NEXT: [[C:%.*]] = and i1 %a, %b
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %c = select i1 %a, i1 %b, i1 %a
+ ret i1 %c
+}
+
+define <2 x i1> @test23vec(<2 x i1> %a, <2 x i1> %b) {
+; CHECK-LABEL: @test23vec(
+; CHECK-NEXT: [[C:%.*]] = select <2 x i1> %a, <2 x i1> %b, <2 x i1> %a
+; CHECK-NEXT: ret <2 x i1> [[C]]
+;
+ %c = select <2 x i1> %a, <2 x i1> %b, <2 x i1> %a
+ ret <2 x i1> %c
+}
+
+define i1 @test24(i1 %a, i1 %b) {
+; CHECK-LABEL: @test24(
+; CHECK-NEXT: [[C:%.*]] = or i1 %a, %b
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %c = select i1 %a, i1 %a, i1 %b
+ ret i1 %c
+}
+
+define <2 x i1> @test24vec(<2 x i1> %a, <2 x i1> %b) {
+; CHECK-LABEL: @test24vec(
+; CHECK-NEXT: [[C:%.*]] = select <2 x i1> %a, <2 x i1> %a, <2 x i1> %b
+; CHECK-NEXT: ret <2 x i1> [[C]]
+;
+ %c = select <2 x i1> %a, <2 x i1> %a, <2 x i1> %b
+ ret <2 x i1> %c
+}
+
+define i1 @test62(i1 %A, i1 %B) {
+; CHECK-LABEL: @test62(
+; CHECK-NEXT: [[NOT:%.*]] = xor i1 %A, true
+; CHECK-NEXT: [[C:%.*]] = and i1 [[NOT]], %B
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %not = xor i1 %A, true
+ %C = select i1 %A, i1 %not, i1 %B
+ ret i1 %C
+}
+
+define <2 x i1> @test62vec(<2 x i1> %A, <2 x i1> %B) {
+; CHECK-LABEL: @test62vec(
+; CHECK-NEXT: [[NOT:%.*]] = xor <2 x i1> %A, <i1 true, i1 true>
+; CHECK-NEXT: [[C:%.*]] = select <2 x i1> %A, <2 x i1> [[NOT]], <2 x i1> %B
+; CHECK-NEXT: ret <2 x i1> [[C]]
+;
+ %not = xor <2 x i1> %A, <i1 true, i1 true>
+ %C = select <2 x i1> %A, <2 x i1> %not, <2 x i1> %B
+ ret <2 x i1> %C
+}
+
+define i1 @test63(i1 %A, i1 %B) {
+; CHECK-LABEL: @test63(
+; CHECK-NEXT: [[NOT:%.*]] = xor i1 %A, true
+; CHECK-NEXT: [[C:%.*]] = or i1 %B, [[NOT]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %not = xor i1 %A, true
+ %C = select i1 %A, i1 %B, i1 %not
+ ret i1 %C
+}
+
+define <2 x i1> @test63vec(<2 x i1> %A, <2 x i1> %B) {
+; CHECK-LABEL: @test63vec(
+; CHECK-NEXT: [[NOT:%.*]] = xor <2 x i1> %A, <i1 true, i1 true>
+; CHECK-NEXT: [[C:%.*]] = select <2 x i1> %A, <2 x i1> %B, <2 x i1> [[NOT]]
+; CHECK-NEXT: ret <2 x i1> [[C]]
+;
+ %not = xor <2 x i1> %A, <i1 true, i1 true>
+ %C = select <2 x i1> %A, <2 x i1> %B, <2 x i1> %not
+ ret <2 x i1> %C
}
define i32 @test11(i32 %a) {
@@ -386,22 +502,6 @@ define i16 @test22(i32 %x) {
; CHECK-NEXT: ret i16
}
-define i1 @test23(i1 %a, i1 %b) {
- %c = select i1 %a, i1 %b, i1 %a
- ret i1 %c
-; CHECK-LABEL: @test23(
-; CHECK-NEXT: %c = and i1 %a, %b
-; CHECK-NEXT: ret i1 %c
-}
-
-define i1 @test24(i1 %a, i1 %b) {
- %c = select i1 %a, i1 %a, i1 %b
- ret i1 %c
-; CHECK-LABEL: @test24(
-; CHECK-NEXT: %c = or i1 %a, %b
-; CHECK-NEXT: ret i1 %c
-}
-
define i32 @test25(i1 %c) {
entry:
br i1 %c, label %jump, label %ret
@@ -878,26 +978,6 @@ define i32 @test61(i32* %ptr) {
; CHECK: ret i32 10
}
-define i1 @test62(i1 %A, i1 %B) {
- %not = xor i1 %A, true
- %C = select i1 %A, i1 %not, i1 %B
- ret i1 %C
-; CHECK-LABEL: @test62(
-; CHECK: %not = xor i1 %A, true
-; CHECK: %C = and i1 %not, %B
-; CHECK: ret i1 %C
-}
-
-define i1 @test63(i1 %A, i1 %B) {
- %not = xor i1 %A, true
- %C = select i1 %A, i1 %B, i1 %not
- ret i1 %C
-; CHECK-LABEL: @test63(
-; CHECK: %not = xor i1 %A, true
-; CHECK: %C = or i1 %B, %not
-; CHECK: ret i1 %C
-}
-
; PR14131
define void @test64(i32 %p, i16 %b) noreturn nounwind {
entry:
More information about the llvm-commits
mailing list