[llvm] 6c81079 - [InstCombine] precommit tests for foldSelectToCopysign
Chenbing Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue May 17 01:52:17 PDT 2022
Author: Chenbing Zheng
Date: 2022-05-17T16:51:54+08:00
New Revision: 6c81079edf26da23f977a82e82f72cc6abd9cafd
URL: https://github.com/llvm/llvm-project/commit/6c81079edf26da23f977a82e82f72cc6abd9cafd
DIFF: https://github.com/llvm/llvm-project/commit/6c81079edf26da23f977a82e82f72cc6abd9cafd.diff
LOG: [InstCombine] precommit tests for foldSelectToCopysign
Added:
Modified:
llvm/test/Transforms/InstCombine/select.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/select.ll b/llvm/test/Transforms/InstCombine/select.ll
index 4f90b14f1b260..7f6bfc4e2bbe9 100644
--- a/llvm/test/Transforms/InstCombine/select.ll
+++ b/llvm/test/Transforms/InstCombine/select.ll
@@ -1691,8 +1691,8 @@ define float @copysign3(float %x) {
; TODO: Allow undefs when matching vectors.
-define <2 x float> @copysign4(<2 x float> %x) {
-; CHECK-LABEL: @copysign4(
+define <2 x float> @copysign_vec_undef(<2 x float> %x) {
+; CHECK-LABEL: @copysign_vec_undef(
; CHECK-NEXT: [[I:%.*]] = bitcast <2 x float> [[X:%.*]] to <2 x i32>
; CHECK-NEXT: [[ISNEG:%.*]] = icmp slt <2 x i32> [[I]], zeroinitializer
; CHECK-NEXT: [[R:%.*]] = select nnan arcp <2 x i1> [[ISNEG]], <2 x float> <float 4.200000e+01, float undef>, <2 x float> <float -4.200000e+01, float -4.200000e+01>
@@ -1704,6 +1704,32 @@ define <2 x float> @copysign4(<2 x float> %x) {
ret <2 x float> %r
}
+define <2 x float> @copysign_vec_undef1(<2 x float> %x) {
+; CHECK-LABEL: @copysign_vec_undef1(
+; CHECK-NEXT: [[I:%.*]] = bitcast <2 x float> [[X:%.*]] to <2 x i32>
+; CHECK-NEXT: [[ISNEG:%.*]] = icmp slt <2 x i32> [[I]], zeroinitializer
+; CHECK-NEXT: [[R:%.*]] = select nnan arcp <2 x i1> [[ISNEG]], <2 x float> <float 4.200000e+01, float 4.200000e+01>, <2 x float> <float undef, float -4.200000e+01>
+; CHECK-NEXT: ret <2 x float> [[R]]
+;
+ %i = bitcast <2 x float> %x to <2 x i32>
+ %isneg = icmp ugt <2 x i32> %i, <i32 2147483647, i32 2147483647>
+ %r = select arcp nnan <2 x i1> %isneg, <2 x float> <float 42.0, float 42.0>, <2 x float> <float undef, float -42.0>
+ ret <2 x float> %r
+}
+
+define <2 x float> @copysign_vec_undef3(<2 x float> %x) {
+; CHECK-LABEL: @copysign_vec_undef3(
+; CHECK-NEXT: [[I:%.*]] = bitcast <2 x float> [[X:%.*]] to <2 x i32>
+; CHECK-NEXT: [[ISNEG:%.*]] = icmp slt <2 x i32> [[I]], zeroinitializer
+; CHECK-NEXT: [[R:%.*]] = select nnan arcp <2 x i1> [[ISNEG]], <2 x float> <float 4.200000e+01, float undef>, <2 x float> <float -4.200000e+01, float undef>
+; CHECK-NEXT: ret <2 x float> [[R]]
+;
+ %i = bitcast <2 x float> %x to <2 x i32>
+ %isneg = icmp ugt <2 x i32> %i, <i32 2147483647, i32 2147483647>
+ %r = select arcp nnan <2 x i1> %isneg, <2 x float> <float 42.0, float undef>, <2 x float> <float -42.0, float undef>
+ ret <2 x float> %r
+}
+
declare void @use1(i1)
; Negative test
More information about the llvm-commits
mailing list