error via bug! instead of stderr+terminate
This commit is contained in:
parent
4fe6acf972
commit
19b81f6114
@ -962,6 +962,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=36732
|
||||
// is fixed.
|
||||
let instr = llvm::LLVMRustBuildVectorReduceFAdd(self.llbuilder, acc, src);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceFAdd is not available in LLVM version < 5.0");
|
||||
}
|
||||
llvm::LLVMRustSetHasUnsafeAlgebra(instr);
|
||||
instr
|
||||
}
|
||||
@ -973,6 +976,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=36732
|
||||
// is fixed.
|
||||
let instr = llvm::LLVMRustBuildVectorReduceFMul(self.llbuilder, acc, src);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceFMul is not available in LLVM version < 5.0");
|
||||
}
|
||||
llvm::LLVMRustSetHasUnsafeAlgebra(instr);
|
||||
instr
|
||||
}
|
||||
@ -980,49 +986,80 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
pub fn vector_reduce_add(&self, src: ValueRef) -> ValueRef {
|
||||
self.count_insn("vector.reduce.add");
|
||||
unsafe {
|
||||
llvm::LLVMRustBuildVectorReduceAdd(self.llbuilder, src)
|
||||
let instr = llvm::LLVMRustBuildVectorReduceAdd(self.llbuilder, src);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceAdd is not available in LLVM version < 5.0");
|
||||
}
|
||||
instr
|
||||
}
|
||||
}
|
||||
pub fn vector_reduce_mul(&self, src: ValueRef) -> ValueRef {
|
||||
self.count_insn("vector.reduce.mul");
|
||||
unsafe {
|
||||
llvm::LLVMRustBuildVectorReduceMul(self.llbuilder, src)
|
||||
let instr = llvm::LLVMRustBuildVectorReduceMul(self.llbuilder, src);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceMul is not available in LLVM version < 5.0");
|
||||
}
|
||||
instr
|
||||
}
|
||||
}
|
||||
pub fn vector_reduce_and(&self, src: ValueRef) -> ValueRef {
|
||||
self.count_insn("vector.reduce.and");
|
||||
unsafe {
|
||||
llvm::LLVMRustBuildVectorReduceAnd(self.llbuilder, src)
|
||||
let instr = llvm::LLVMRustBuildVectorReduceAnd(self.llbuilder, src);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceAnd is not available in LLVM version < 5.0");
|
||||
}
|
||||
instr
|
||||
}
|
||||
}
|
||||
pub fn vector_reduce_or(&self, src: ValueRef) -> ValueRef {
|
||||
self.count_insn("vector.reduce.or");
|
||||
unsafe {
|
||||
llvm::LLVMRustBuildVectorReduceOr(self.llbuilder, src)
|
||||
let instr = llvm::LLVMRustBuildVectorReduceOr(self.llbuilder, src);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceOr is not available in LLVM version < 5.0");
|
||||
}
|
||||
instr
|
||||
}
|
||||
}
|
||||
pub fn vector_reduce_xor(&self, src: ValueRef) -> ValueRef {
|
||||
self.count_insn("vector.reduce.xor");
|
||||
unsafe {
|
||||
llvm::LLVMRustBuildVectorReduceXor(self.llbuilder, src)
|
||||
let instr = llvm::LLVMRustBuildVectorReduceXor(self.llbuilder, src);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceXor is not available in LLVM version < 5.0");
|
||||
}
|
||||
instr
|
||||
}
|
||||
}
|
||||
pub fn vector_reduce_fmin(&self, src: ValueRef) -> ValueRef {
|
||||
self.count_insn("vector.reduce.fmin");
|
||||
unsafe {
|
||||
llvm::LLVMRustBuildVectorReduceFMin(self.llbuilder, src, true)
|
||||
let instr = llvm::LLVMRustBuildVectorReduceFMin(self.llbuilder, src, true);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceFMin is not available in LLVM version < 5.0");
|
||||
}
|
||||
instr
|
||||
}
|
||||
}
|
||||
pub fn vector_reduce_fmax(&self, src: ValueRef) -> ValueRef {
|
||||
self.count_insn("vector.reduce.fmax");
|
||||
unsafe {
|
||||
llvm::LLVMRustBuildVectorReduceFMax(self.llbuilder, src, true)
|
||||
let instr = llvm::LLVMRustBuildVectorReduceFMax(self.llbuilder, src, true);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceFMax is not available in LLVM version < 5.0");
|
||||
}
|
||||
instr
|
||||
}
|
||||
}
|
||||
pub fn vector_reduce_fmin_fast(&self, src: ValueRef) -> ValueRef {
|
||||
self.count_insn("vector.reduce.fmin_fast");
|
||||
unsafe {
|
||||
let instr = llvm::LLVMRustBuildVectorReduceFMin(self.llbuilder, src, false);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceFMin is not available in LLVM version < 5.0");
|
||||
}
|
||||
llvm::LLVMRustSetHasUnsafeAlgebra(instr);
|
||||
instr
|
||||
}
|
||||
@ -1031,6 +1068,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
self.count_insn("vector.reduce.fmax_fast");
|
||||
unsafe {
|
||||
let instr = llvm::LLVMRustBuildVectorReduceFMax(self.llbuilder, src, false);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceFMax is not available in LLVM version < 5.0");
|
||||
}
|
||||
llvm::LLVMRustSetHasUnsafeAlgebra(instr);
|
||||
instr
|
||||
}
|
||||
@ -1038,13 +1078,21 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
pub fn vector_reduce_min(&self, src: ValueRef, is_signed: bool) -> ValueRef {
|
||||
self.count_insn("vector.reduce.min");
|
||||
unsafe {
|
||||
llvm::LLVMRustBuildVectorReduceMin(self.llbuilder, src, is_signed)
|
||||
let instr = llvm::LLVMRustBuildVectorReduceMin(self.llbuilder, src, is_signed);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceMin is not available in LLVM version < 5.0");
|
||||
}
|
||||
instr
|
||||
}
|
||||
}
|
||||
pub fn vector_reduce_max(&self, src: ValueRef, is_signed: bool) -> ValueRef {
|
||||
self.count_insn("vector.reduce.max");
|
||||
unsafe {
|
||||
llvm::LLVMRustBuildVectorReduceMax(self.llbuilder, src, is_signed)
|
||||
let instr = llvm::LLVMRustBuildVectorReduceMax(self.llbuilder, src, is_signed);
|
||||
if instr.is_null() {
|
||||
bug!("LLVMRustBuildVectorReduceMax is not available in LLVM version < 5.0");
|
||||
}
|
||||
instr
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1447,65 +1447,48 @@ LLVMRustBuildVectorReduceFMax(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) {
|
||||
|
||||
#else
|
||||
|
||||
void error_and_exit(const char* msg) {
|
||||
raw_fd_ostream OS(2, false);
|
||||
OS << ::std::string(msg);
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceFAdd(LLVMBuilderRef, LLVMValueRef, LLVMValueRef Src) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceFAdd requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceFAdd(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceFMul(LLVMBuilderRef, LLVMValueRef, LLVMValueRef Src) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceFMul requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceFMul(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceAdd(LLVMBuilderRef, LLVMValueRef Src) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceAdd requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceAdd(LLVMBuilderRef, LLVMValueRef) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceMul(LLVMBuilderRef, LLVMValueRef Src) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceMul requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceMul(LLVMBuilderRef, LLVMValueRef) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceAnd(LLVMBuilderRef, LLVMValueRef Src) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceAnd requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceAnd(LLVMBuilderRef, LLVMValueRef) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceOr(LLVMBuilderRef, LLVMValueRef Src) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceOr requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceOr(LLVMBuilderRef, LLVMValueRef) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceXor(LLVMBuilderRef, LLVMValueRef Src) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceXor requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceXor(LLVMBuilderRef, LLVMValueRef) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceMin(LLVMBuilderRef, LLVMValueRef Src, bool) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceMin requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceMin(LLVMBuilderRef, LLVMValueRef, bool) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceMax(LLVMBuilderRef, LLVMValueRef Src, bool) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceMax requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceMax(LLVMBuilderRef, LLVMValueRef, bool) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceFMin(LLVMBuilderRef, LLVMValueRef Src, bool) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceFMin requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceFMin(LLVMBuilderRef, LLVMValueRef, bool) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceFMax(LLVMBuilderRef, LLVMValueRef Src, bool) {
|
||||
error_and_exit("LLVMRustBuildVectorReduceFMax requires LLVM >= 5.0");
|
||||
return Src;
|
||||
LLVMRustBuildVectorReduceFMax(LLVMBuilderRef, LLVMValueRef, bool) {
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user