Commit Graph

83 Commits

Author SHA1 Message Date
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
Jacob Young
0bd92da0e2 target: fix typos in x86 feature descriptions 2023-05-08 07:36:20 -04:00
Linus Groh
94e30a756e std: fix a bunch of typos
The majority of these are in comments, some in doc comments which might
affect the generated documentation, and a few in parameter names -
nothing that should be breaking, however.
2023-04-30 18:16:04 -07:00
serg
5bc35fa75b std.target.riscv: fix baseline_rv32 missing feature "32bit" 2023-04-18 18:37:15 -07:00
Robin Voetter
6dc1fafe98
std: add generic target for spirv
This adds a general target for SPIR-V compilation. Previously there was not
any target machine defined for SPIR-V.

TODO is to reword the features for this target. We don't really need the full
list of capabilities in the features, we should only put a few features here
which we can actually use during code generation.
2023-04-09 01:51:47 +02:00
Andrew Kelley
d399f8a489 Merge remote-tracking branch 'origin/master' into llvm16 2023-02-27 16:10:48 -07:00
Andrew Kelley
b5b634e4e8 Merge remote-tracking branch 'origin/master' into llvm16 2023-02-19 10:20:19 -07:00
Andrew Kelley
aeaef8c0ff update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
Andrew Kelley
0ca3582a86 update CPU features to LLVM 16 2023-01-26 16:36:14 -07:00
Jay Petacat
694d8831c3 Revert "x86" CPU model (not arch) back to "i386"
PR #13101 recently renamed the "i386" architecture to "x86", and it
seems the specific CPU model got swept up in that. "x86" is an umbrella
term that describes a family of CPUs, and the "i386" is the oldest
supported model under that umbrella.
2022-11-06 13:39:03 +01:00
Ali Chraghi
f5f1f8c666 all: rename i386 to x86 2022-11-04 00:09:27 +03:30
Andrew Kelley
5b9c8d1d6f add m68k target CPU features 2022-10-20 09:21:06 -07:00
Andrew Kelley
4962f36b0f synchronize target CPU features with LLVM 15.0.3 2022-10-18 10:18:09 -07:00
Andrew Kelley
c75226d033 update target CPU features for LLVM 15 2022-08-02 19:22:09 -07:00
Meghan Denny
b5861193e0 std: rename std.Target.systemz to .s390x 2022-07-28 23:22:44 -07:00
Andrew Kelley
d55d98919d update CPU features to LLVM 14
Notable changes:

`_i386`, `_i486`, and `_i686` are renamed to `i386`, `i486`,
and `i686` respectively. `std.zig.fmtId` is enhanced to support
formatting `i386` as `@"i386"`.

Some CPU features which are actually CPU models have been
properly flattened, such as `apple_a12`, `apple_a13`, `apple_a7`,
`cortex_a78c`, `exynos_m4`, `neoverse_e1`, `neoverse_n1`,
`neoverse_n2`, `neoverse_v1`.

Some CPU features have been added and some have been removed, following
LLVM's lead.

CSky CPU features support is added.
2022-07-01 21:35:19 -07:00
Andrew Kelley
7adf15682c update target CPU features with LLVM 13 rc1 data 2021-08-15 23:09:55 -07:00
Andrew Kelley
fc55814faa compiler-rt: do not depend on usingnamespace
The idea is to depend on this language feature as little as possible
with the hopes that it can be adjusted to be less of an anti-pattern.
This also helps self-hosted, which does not yet implement
`usingnamespace`, get closer to being able to build compiler-rt.
2021-08-12 10:48:54 -07:00
d18g
0e71e6ee0f
Fix lakemont CpuModel (#9099)
Lakemont has no x86, no MMX, no SSE and no way of handling any fp-math. In theory LLVM is able to implicitly use the soft-float emulation library calls to legalize any such operation but, given Zig's use of many non-standard features, sometimes we hit a weak spot in the X86 codegen backend.

Consider this as a work-around for this LLVM problem, fixing the problem in LLVM is not so high in my todo list as the target is pretty niche and Intel axed it in '19.

(Commit message by @LemonBoy)
2021-06-17 16:37:38 -04:00
Isaac Freund
5b850d5c92
Run zig fmt on src/ and lib/std/
This replaces callconv(.Inline) with the more idiomatic inline keyword.
2021-05-20 17:14:18 +02:00
Robin Voetter
98dc8eb7d9 SPIR-V: Add generated SPIR-V features 2021-05-14 19:49:32 +02:00
LemonBoy
3eed613407 std: Add two more ARM CPUs to the known CPU list
Modeled after GCC's description.
2021-05-03 12:32:13 +02:00
Michael Dusan
0c6dfa6f0c target: drop ppc32 and prefer ppc
- original PR #7949 (incorrectly) patched a generated-file and changes
  have subsequently been lost/overwritten
- fix #7947 in a different way: drop `ppc32` because `ppc` already exists
2021-04-20 16:19:59 -04:00
Andrew Kelley
ab36a162d0 update ARM target CPU features
This completes the process. All target CPU features are now
auto-generated by the tools/update_cpu_features.zig script, which
contains all the overrides.

Invoking this tool against LLVM 12rc2 now produces an empty git diff.
2021-02-27 21:10:00 -07:00
Andrew Kelley
85ab1b01e7 tools/update_cpu_features: add a "flatten" feature
and use it to clean up aarch64 target CPU features
2021-02-27 17:26:06 -07:00
Andrew Kelley
e02acc0288 tools/update_cpu_features: better patching API
With this change, added & modified cpus & features participate in the
same pruning system, and sorting takes into account the zig name, not
the pre-modified llvm name.

The modified target files in this commit are due to the improved
sorting and pruning.

The script now fully supports extra cpus & features.
2021-02-27 15:57:01 -07:00
Andrew Kelley
02bda72d91 update amdgpu target CPU features 2021-02-27 01:54:07 -07:00
Andrew Kelley
a9f19221e9 update RISC-V target CPU features 2021-02-27 01:49:35 -07:00
Andrew Kelley
50a5fc98dc update most target CPU features to llvm12
The tools/update_cpu_features script is coming along, and generates
correct information for all these targets. The remaining targets are:

 * arm
 * aarch64
 * amdgpu
 * riscv

I will commit them once the issues with the updater tool are resolved.
2021-02-27 01:05:53 -07:00
Andrew Kelley
59b4facd34 update x86 CPU features 2021-02-27 00:54:40 -07:00
Andrew Kelley
0b58b61799 Merge remote-tracking branch 'origin/master' into llvm12
Conflicts:
 * src/clang.zig
 * src/llvm.zig
   - this file got moved to src/llvm/bindings.zig in master branch so I
     had to put the new LLVM arch/os enum tags into it.
 * lib/std/target.zig, src/stage1/target.cpp
   - haiku had an inconsistency with its default target ABI, gnu vs
     eabi. In this commit we make it gnu in both places to match the
     latest changes by @hoanga.
 * src/translate_c.zig
2021-02-25 21:04:23 -07:00
Michael Dusan
300ebbd560 target: map zig ppc32 → llvm ppc
- llvm does not accept `ppc32` as a CPU type

closes #7947
2021-02-04 14:22:38 -08:00
Frank Denis
6c2e0c2046 Year++ 2020-12-31 15:45:24 -08:00
Andrew Kelley
8f1408578c update the CPU target features and models
Rather than directly pasting the output from the
target-details-generator tool, we have to look at the diff line by line
and decide how to incorporate the changes.

The baseline abstraction is something that Zig provides.

The changes to x86 appear to be incorrect. After LLVM commit
3ad09fd03c51823aeb0bcbd7898aada33e9228d6 the CPU features are stored in
a different data layout in their tables, and so we need to update the
target details extraction tool to match.
2020-12-16 17:25:48 -07:00
Jakub Konka
6f3ed2f71f Update target details
llvm commit b2851aea80e5a8f0cfd6c3c5a56a6b00fb28c6b6
zig-llvm-target-details-generator commit
4299674ecabeb668b0d84285cd1b41a652a391b1
2020-12-16 18:13:52 +01:00
Koakuma
cefbe4e7be Use correct names for generic SPARC targets
LLVM calls generic sparc32 CPUs "v8" and generic sparc64 CPUs "v9".
2020-10-24 20:03:41 +07:00
Andrew Kelley
f9bd049c89 Merge remote-tracking branch 'origin/master' into llvm11 2020-08-21 14:50:37 -07:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Andrew Kelley
1de2c647df Merge remote-tracking branch 'origin/master' into llvm11 2020-08-18 15:32:42 -07:00
Koakuma
cb06d62603
Add "ppc" prefix to number-modeled CPUs (#6006)
This is to prevent "expected token 'Symbol', found 'IntLiteral'" errors
when building zig files.
2020-08-13 14:30:38 +03:00
Andrew Kelley
316b4bde6a update target CPU features from llvm 10 to 11rc1 2020-08-04 21:46:49 -07:00
Vexu
9907116478
use typeInfo instead of hardcoded tables in std.Target 2020-07-11 20:11:20 +03:00
Carter Sande
09cded209d Add strict_align to pre-v6 ARM targets
This matches GCC's and Clang's default behavior for these targets.
2020-06-12 13:43:12 -04:00
Andrew Kelley
d1cb16aace
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-03 09:44:13 -05:00
Andrew Kelley
2b33e27e1c
arm baseline CPU is v7a rather than v6m
v6m is thumb-mode and the baseline should probably be an 'a' variant.
2020-02-26 12:37:13 -05:00
Andrew Kelley
f33bf48af7
Merge remote-tracking branch 'origin/master' into llvm10 2020-02-25 16:30:40 -05:00
Andrew Kelley
7da7fbb912
update ARM cpu models to correctly include the sub-arch 2020-02-21 12:29:27 -05:00
Andrew Kelley
33c69d5cb6
arm: clarify which CPU features are sub-architectures
versus which ones are instruction sets.
2020-02-20 15:27:42 -05:00
Andrew Kelley
9c3eff9193
Revert "arm: clean up the messy sub-architecture & CPU features"
This reverts commit 96f45c27b6.
2020-02-20 12:18:32 -05:00
Andrew Kelley
84f1893c18
remove the concept of "sub-architecture"
in favor of CPU features. Also rearrange the `std.Target`
data structure.

 * note: `@import("builtin")` was already deprecated in favor of
   `@import("std").builtin`.
 * `std.builtin.arch` is now deprecated in favor of
   `std.builtin.cpu.arch`.
 * `std.Target.CpuFeatures.Cpu` is now `std.Target.Cpu.Model`.
 * `std.Target.CpuFeatures` is now `std.Target.Cpu`.
 * `std.Target` no longer has an `arch` field. Instead it has a
   `cpu` field, which has `arch`, `model`, and `features`.
 * `std.Target` no longer has a `cpu_features` field.
 * `std.Target.Arch` is moved to `std.Target.Cpu.Arch` and
   it is an enum instead of a tagged union.
 * `std.Target.parseOs` is moved to `std.Target.Os.parse`.
 * `std.Target.parseAbi` is moved to `std.Target.Abi.parse`.
 * `std.Target.parseArchSub` is only for arch now and moved
    to `std.Target.Cpu.Arch.parse`.
 * `std.Target.parse` is improved to accept CPU name and features.
 * `std.Target.Arch.getBaselineCpuFeatures` is moved to
   `std.Target.Cpu.baseline`.
 * `std.Target.allCpus` is renamed to `std.Target.allCpuModels`.
 * `std.Target.defaultAbi` is moved to `std.Target.Abi.default`.
 * Significant cleanup of aarch64 and arm CPU features, resulting in
   the needed bit count for cpu feature set going from 174 to 138.
 * Add `std.Target.Cpu.Feature.Set.addFeatureSet` for merging
   feature sets together.

`-target-feature` and `-target-cpu` are removed in favor of
`-mcpu`, to conform to established conventions, and it gains
additional power to support cpu features. The syntax is:
-mcpu=name+on1+on2-off1-off2

closes #4261
2020-02-19 21:30:36 -05:00