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> , <2 x float> @@ -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> , <2 x float> +; CHECK-NEXT: ret <2 x float> [[R]] +; + %i = bitcast <2 x float> %x to <2 x i32> + %isneg = icmp ugt <2 x i32> %i, + %r = select arcp nnan <2 x i1> %isneg, <2 x float> , <2 x float> + 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> , <2 x float> +; CHECK-NEXT: ret <2 x float> [[R]] +; + %i = bitcast <2 x float> %x to <2 x i32> + %isneg = icmp ugt <2 x i32> %i, + %r = select arcp nnan <2 x i1> %isneg, <2 x float> , <2 x float> + ret <2 x float> %r +} + declare void @use1(i1) ; Negative test