diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-02-18 05:25:36 +0100 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-06-05 06:12:00 +0200 |
| commit | 9d534790ebc869ec933e932abe4be8b9e3593bbc (patch) | |
| tree | 70652dde381fd0c0d536d8e7665e725e0924bb51 /src/link/Elf/Object.zig | |
| parent | 14873f9a3434a0d753ca8438f389a7931956cf26 (diff) | |
| download | zig-9d534790ebc869ec933e932abe4be8b9e3593bbc.tar.gz zig-9d534790ebc869ec933e932abe4be8b9e3593bbc.zip | |
std.Target: Introduce Cpu convenience functions for feature tests.
Before:
* std.Target.arm.featureSetHas(target.cpu.features, .has_v7)
* std.Target.x86.featureSetHasAny(target.cpu.features, .{ .sse, .avx, .cmov })
* std.Target.wasm.featureSetHasAll(target.cpu.features, .{ .atomics, .bulk_memory })
After:
* target.cpu.has(.arm, .has_v7)
* target.cpu.hasAny(.x86, &.{ .sse, .avx, .cmov })
* target.cpu.hasAll(.wasm, &.{ .atomics, .bulk_memory })
Diffstat (limited to 'src/link/Elf/Object.zig')
| -rw-r--r-- | src/link/Elf/Object.zig | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/link/Elf/Object.zig b/src/link/Elf/Object.zig index f489294aa0..2597553544 100644 --- a/src/link/Elf/Object.zig +++ b/src/link/Elf/Object.zig @@ -187,7 +187,6 @@ pub fn validateEFlags( ) !void { switch (target.cpu.arch) { .riscv64 => { - const features = target.cpu.features; const flags: riscv.Eflags = @bitCast(e_flags); var any_errors: bool = false; @@ -196,7 +195,7 @@ pub fn validateEFlags( // Invalid when // 1. The input uses C and we do not. - if (flags.rvc and !std.Target.riscv.featureSetHas(features, .c)) { + if (flags.rvc and !target.cpu.has(.riscv, .c)) { any_errors = true; diags.addParseError( path, @@ -208,7 +207,7 @@ pub fn validateEFlags( // Invalid when // 1. We use E and the input does not. // 2. The input uses E and we do not. - if (std.Target.riscv.featureSetHas(features, .e) != flags.rve) { + if (target.cpu.has(.riscv, .e) != flags.rve) { any_errors = true; diags.addParseError( path, @@ -225,7 +224,7 @@ pub fn validateEFlags( // Invalid when // 1. We use total store order and the input does not. // 2. The input uses total store order and we do not. - if (flags.tso != std.Target.riscv.featureSetHas(features, .ztso)) { + if (flags.tso != target.cpu.has(.riscv, .ztso)) { any_errors = true; diags.addParseError( path, @@ -235,9 +234,9 @@ pub fn validateEFlags( } const fabi: riscv.Eflags.FloatAbi = - if (std.Target.riscv.featureSetHas(features, .d)) + if (target.cpu.has(.riscv, .d)) .double - else if (std.Target.riscv.featureSetHas(features, .f)) + else if (target.cpu.has(.riscv, .f)) .single else .soft; |
