Merge remote-tracking branch 'origin/master' into llvm13

Conflicts:

 * cmake/Findclang.cmake
 * cmake/Findlld.cmake
 * cmake/Findllvm.cmake

In master branch, more search paths were added to these files with "12"
in the path. In this commit I updated them to "13".

 * src/stage1/codegen.cpp
 * src/zig_llvm.cpp
 * src/zig_llvm.h

In master branch, ZigLLVMBuildCmpXchg is improved to add
`is_single_threaded`. However, the LLVM 13 C API has this already, and
in the llvm13 branch, ZigLLVMBuildCmpXchg is deleted in favor of the C
API. In this commit I updated stage2 to use the LLVM 13 C API rather
than depending on an improved ZigLLVMBuildCmpXchg.

Additionally, src/target.zig largestAtomicBits needed to be updated to
include the new m68k ISA.
This commit is contained in:
Andrew Kelley
2021-09-15 14:46:31 -07:00
282 changed files with 34565 additions and 32482 deletions

View File

@@ -3335,6 +3335,46 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, Stage1Air *executable,
} else {
zig_unreachable();
}
case IrBinOpSatAdd:
if (scalar_type->id == ZigTypeIdInt) {
if (scalar_type->data.integral.is_signed) {
return ZigLLVMBuildSAddSat(g->builder, op1_value, op2_value, "");
} else {
return ZigLLVMBuildUAddSat(g->builder, op1_value, op2_value, "");
}
} else {
zig_unreachable();
}
case IrBinOpSatSub:
if (scalar_type->id == ZigTypeIdInt) {
if (scalar_type->data.integral.is_signed) {
return ZigLLVMBuildSSubSat(g->builder, op1_value, op2_value, "");
} else {
return ZigLLVMBuildUSubSat(g->builder, op1_value, op2_value, "");
}
} else {
zig_unreachable();
}
case IrBinOpSatMul:
if (scalar_type->id == ZigTypeIdInt) {
if (scalar_type->data.integral.is_signed) {
return ZigLLVMBuildSMulFixSat(g->builder, op1_value, op2_value, "");
} else {
return ZigLLVMBuildUMulFixSat(g->builder, op1_value, op2_value, "");
}
} else {
zig_unreachable();
}
case IrBinOpSatShl:
if (scalar_type->id == ZigTypeIdInt) {
if (scalar_type->data.integral.is_signed) {
return ZigLLVMBuildSShlSat(g->builder, op1_value, op2_value, "");
} else {
return ZigLLVMBuildUShlSat(g->builder, op1_value, op2_value, "");
}
} else {
zig_unreachable();
}
}
zig_unreachable();
}
@@ -9094,6 +9134,10 @@ static void define_builtin_fns(CodeGen *g) {
create_builtin_fn(g, BuiltinFnIdReduce, "reduce", 2);
create_builtin_fn(g, BuiltinFnIdMaximum, "maximum", 2);
create_builtin_fn(g, BuiltinFnIdMinimum, "minimum", 2);
create_builtin_fn(g, BuiltinFnIdSatAdd, "addWithSaturation", 2);
create_builtin_fn(g, BuiltinFnIdSatSub, "subWithSaturation", 2);
create_builtin_fn(g, BuiltinFnIdSatMul, "mulWithSaturation", 2);
create_builtin_fn(g, BuiltinFnIdSatShl, "shlWithSaturation", 2);
}
static const char *bool_to_str(bool b) {