Index: llvm/include/llvm/IR/Intrinsics.td =================================================================== --- llvm/include/llvm/IR/Intrinsics.td +++ llvm/include/llvm/IR/Intrinsics.td @@ -1518,32 +1518,32 @@ def int_vector_reduce_fadd : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], [LLVMVectorElementType<0>, - llvm_anyvector_ty]>; + llvm_anyfloat_ty]>; def int_vector_reduce_fmul : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], [LLVMVectorElementType<0>, - llvm_anyvector_ty]>; + llvm_anyfloat_ty]>; def int_vector_reduce_add : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyint_ty]>; def int_vector_reduce_mul : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyint_ty]>; def int_vector_reduce_and : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyint_ty]>; def int_vector_reduce_or : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyint_ty]>; def int_vector_reduce_xor : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyint_ty]>; def int_vector_reduce_smax : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyint_ty]>; def int_vector_reduce_smin : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyint_ty]>; def int_vector_reduce_umax : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyint_ty]>; def int_vector_reduce_umin : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyint_ty]>; def int_vector_reduce_fmax : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyfloat_ty]>; def int_vector_reduce_fmin : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], - [llvm_anyvector_ty]>; + [llvm_anyfloat_ty]>; } //===----- Matrix intrinsics ---------------------------------------------===// Index: llvm/test/Verifier/reduction-intrinsics.ll =================================================================== --- /dev/null +++ llvm/test/Verifier/reduction-intrinsics.ll @@ -0,0 +1,30 @@ +; RUN: not opt -S -verify < %s 2>&1 | FileCheck %s + +define float @not_float_reduce(<4 x float> %x) { +; CHECK: Intrinsic has incorrect argument type! + %r = call float @llvm.vector.reduce.umin.v4f32(<4 x float> %x) + ret float %r +} + +define i32* @not_pointer_reduce(<4 x i32*> %x) { +; CHECK: Intrinsic has incorrect argument type! + %r = call i32* @llvm.vector.reduce.or.v4p0i32(<4 x i32*> %x) + ret i32* %r +} + +define i32 @not_integer_reduce(<4 x i32> %x) { +; CHECK: Intrinsic has incorrect argument type! + %r = call i32 @llvm.vector.reduce.fadd.v4i32(i32 0, <4 x i32> %x) + ret i32 %r +} + +define i32* @not_pointer_reduce2(<4 x i32*> %x) { +; CHECK: Intrinsic has incorrect argument type! + %r = call i32* @llvm.vector.reduce.fmin.v4p0i32(<4 x i32*> %x) + ret i32* %r +} + +declare float @llvm.vector.reduce.umin.v4f32(<4 x float>) +declare i32* @llvm.vector.reduce.or.v4p0i32(<4 x i32*>) +declare i32 @llvm.vector.reduce.fadd.v4i32(i32, <4 x i32>) +declare i32* @llvm.vector.reduce.fmin.v4p0i32(<4 x i32*>)