aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-09-15 14:46:31 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-09-15 14:51:08 -0700
commitf3ebfcae3882c03da84821abed40167ea07a8c78 (patch)
treef1b759c94cba5b020a9ffb141fc62cb686fc5f04 /src/target.zig
parent111a2dcf3ad53c0c8ad2c9e7c9bd042b81e90c82 (diff)
parent0395b35cee8d4082cc40b0dcd0298f797f42309d (diff)
downloadzig-f3ebfcae3882c03da84821abed40167ea07a8c78.tar.gz
zig-f3ebfcae3882c03da84821abed40167ea07a8c78.zip
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.
Diffstat (limited to 'src/target.zig')
-rw-r--r--src/target.zig70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/target.zig b/src/target.zig
index 6f50c8d5e9..4f9898cfa8 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -480,3 +480,73 @@ pub fn clangAssemblerSupportsMcpuArg(target: std.Target) bool {
pub fn needUnwindTables(target: std.Target) bool {
return target.os.tag == .windows;
}
+
+/// TODO this was ported from stage1 but it does not take into account CPU features,
+/// which can affect this value. Audit this!
+pub fn largestAtomicBits(target: std.Target) u32 {
+ return switch (target.cpu.arch) {
+ .avr,
+ .msp430,
+ .spu_2,
+ => 16,
+
+ .arc,
+ .arm,
+ .armeb,
+ .hexagon,
+ .m68k,
+ .le32,
+ .mips,
+ .mipsel,
+ .nvptx,
+ .powerpc,
+ .powerpcle,
+ .r600,
+ .riscv32,
+ .sparc,
+ .sparcel,
+ .tce,
+ .tcele,
+ .thumb,
+ .thumbeb,
+ .i386,
+ .xcore,
+ .amdil,
+ .hsail,
+ .spir,
+ .kalimba,
+ .lanai,
+ .shave,
+ .wasm32,
+ .renderscript32,
+ .csky,
+ .spirv32,
+ => 32,
+
+ .aarch64,
+ .aarch64_be,
+ .aarch64_32,
+ .amdgcn,
+ .bpfel,
+ .bpfeb,
+ .le64,
+ .mips64,
+ .mips64el,
+ .nvptx64,
+ .powerpc64,
+ .powerpc64le,
+ .riscv64,
+ .sparcv9,
+ .s390x,
+ .amdil64,
+ .hsail64,
+ .spir64,
+ .wasm64,
+ .renderscript64,
+ .ve,
+ .spirv64,
+ => 64,
+
+ .x86_64 => 128,
+ };
+}