mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Default to AVX on x64.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
- Support `defer (catch err)`
|
||||
- Added `print-input` command argument to print all files used for compilation
|
||||
- Allow recursive function definitions as long as they are pointers. #1182
|
||||
- Default CPU to native if less than AVX, otherwise use AVX.
|
||||
|
||||
### Fixes
|
||||
- Incorrect length passed to scratch buffer printf.
|
||||
|
||||
@@ -202,7 +202,7 @@ typedef enum
|
||||
X86VECTOR_SSE = 2,
|
||||
X86VECTOR_AVX = 3,
|
||||
X86VECTOR_AVX512 = 4,
|
||||
X86VECTOR_NATIVE = 5,
|
||||
X86VECTOR_CPU = 5,
|
||||
} X86VectorCapability;
|
||||
|
||||
typedef enum
|
||||
|
||||
@@ -59,7 +59,7 @@ static const char *x86_vector_capability[6] = {
|
||||
[X86VECTOR_SSE] = "sse",
|
||||
[X86VECTOR_AVX] = "avx",
|
||||
[X86VECTOR_AVX512] = "avx512",
|
||||
[X86VECTOR_NATIVE] = "native"
|
||||
[X86VECTOR_CPU] = "default"
|
||||
};
|
||||
|
||||
static const char *optlevels[4] = {
|
||||
|
||||
@@ -142,7 +142,7 @@ static void usage(void)
|
||||
OUTPUT("");
|
||||
OUTPUT(" --reloc=<option> - Relocation model: none, pic, PIC, pie, PIE.");
|
||||
OUTPUT(" --x86cpu=<option> - Set general level of x64 cpu: baseline, ssse3, sse4, avx1, avx2-v1, avx2-v2 (Skylake/Zen1+), avx512 (Icelake/Zen4+), native.");
|
||||
OUTPUT(" --x86vec=<option> - Set max type of vector use: none, mmx, sse, avx, avx512, native.");
|
||||
OUTPUT(" --x86vec=<option> - Set max type of vector use: none, mmx, sse, avx, avx512, default.");
|
||||
OUTPUT(" --riscvfloat=<option> - Set type of RISC-V float support: none, float, double");
|
||||
OUTPUT(" --memory-env=<option> - Set the memory environment: normal, small, tiny, none.");
|
||||
OUTPUT(" --strip-unused=<yes|no> - Strip unused code and globals from the output. (default: yes)");
|
||||
|
||||
@@ -738,7 +738,7 @@ static void x64features_limit_from_capability(X86Features *cpu_features, X86Vect
|
||||
x86features_remove_feature(cpu_features, X86_FEAT_AVX512VPOPCNTDQ);
|
||||
break;
|
||||
case X86VECTOR_AVX512:
|
||||
case X86VECTOR_NATIVE:
|
||||
case X86VECTOR_CPU:
|
||||
case X86VECTOR_DEFAULT:
|
||||
break;
|
||||
}
|
||||
@@ -910,21 +910,16 @@ static inline void target_setup_x64_abi(BuildTarget *target)
|
||||
platform_target.abi = ABI_X64;
|
||||
X86CpuSet cpu_set;
|
||||
platform_target.x64.is_win64 = platform_target.os == OS_TYPE_WIN32;
|
||||
bool is_native = target->arch_os_target == default_target;
|
||||
if (!is_native && target->feature.x86_cpu_set == X86CPU_NATIVE) target->feature.x86_cpu_set = X86CPU_DEFAULT;
|
||||
if (target->feature.x86_cpu_set != X86CPU_DEFAULT)
|
||||
{
|
||||
cpu_set = target->feature.x86_cpu_set;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (platform_target.os)
|
||||
{
|
||||
case OS_TYPE_MACOSX:
|
||||
cpu_set = X86CPU_AVX1;
|
||||
break;
|
||||
default:
|
||||
cpu_set = X86CPU_SSSE3;
|
||||
break;
|
||||
}
|
||||
cpu_set = is_native ? x64_cpu_default() : X86CPU_AVX1;
|
||||
if (cpu_set > X86CPU_AVX1) cpu_set = X86CPU_AVX1;
|
||||
INFO_LOG("Set default CPU as %s\n", x86_cpu_set[cpu_set]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// #target: macos-x64
|
||||
fn int* elvis(int *x, int *y)
|
||||
{
|
||||
return x ?: y;
|
||||
|
||||
Reference in New Issue
Block a user