| author | |
| committer | |
| log | 1235bc67e20730dbf8741f56a15ac21989d72833 |
| tree | 6660c25f52c6561ebb953865c5ad7d98fda2fd29 |
| parent | c60a3bbdc11c10d4ee60e42d198ab11d8da03265 |
| signature | Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM |
Not really sure why I thought this was necessary. Clearly we're not going to be
targeting LoongArch with MSVC.2 files changed, 5 insertions(+), 29 deletions(-)
lib/std/zig/system/loongarch.zig+4-16| ... | ... | @@ -94,21 +94,9 @@ pub fn detectNativeCpuAndFeatures( |
| 94 | 94 | return cpu; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | /// This is a workaround for the C backend until zig has the ability to put | |
| 98 | /// C code in inline assembly. | |
| 99 | extern fn zig_loongarch_cpucfg(word: u32, result: *u32) callconv(.c) void; | |
| 100 | ||
| 101 | 97 | fn cpucfg(word: u32) u32 { |
| 102 | var result: u32 = undefined; | |
| 103 | ||
| 104 | if (builtin.zig_backend == .stage2_c) { | |
| 105 | zig_loongarch_cpucfg(word, &result); | |
| 106 | } else { | |
| 107 | asm ("cpucfg %[result], %[word]" | |
| 108 | : [result] "=r" (result), | |
| 109 | : [word] "r" (word), | |
| 110 | ); | |
| 111 | } | |
| 112 | ||
| 113 | return result; | |
| 98 | return asm ("cpucfg %[result], %[word]" | |
| 99 | : [result] "=r" (-> u32), | |
| 100 | : [word] "r" (word), | |
| 101 | ); | |
| 114 | 102 | } |
lib/zig.h+1-13| ... | ... | @@ -6750,19 +6750,7 @@ static inline void* zig_e_zig_windows_peb(void) { |
| 6750 | 6750 | |
| 6751 | 6751 | #endif |
| 6752 | 6752 | |
| 6753 | #if defined(zig_loongarch) | |
| 6754 | ||
| 6755 | static inline void zig_e_zig_loongarch_cpucfg(uint32_t word, uint32_t* result) zig_mangled(zig_e_zig_loongarch_cpucfg, "zig_loongarch_cpucfg"); | |
| 6756 | ||
| 6757 | static inline void zig_e_zig_loongarch_cpucfg(uint32_t word, uint32_t* result) { | |
| 6758 | #if defined(zig_gnuc_asm) | |
| 6759 | __asm__("cpucfg %[result], %[word]" : [result] "=r" (*result) : [word] "r" (word)); | |
| 6760 | #else | |
| 6761 | *result = 0; | |
| 6762 | #endif | |
| 6763 | } | |
| 6764 | ||
| 6765 | #elif defined(zig_x86) && !defined(zig_x86_16) | |
| 6753 | #if defined(zig_x86) && !defined(zig_x86_16) | |
| 6766 | 6754 | |
| 6767 | 6755 | static inline void zig_e_zig_x86_cpuid(uint32_t leaf_id, uint32_t subid, uint32_t* eax, uint32_t* ebx, uint32_t* ecx, uint32_t* edx) zig_mangled(zig_e_zig_x86_cpuid, "zig_x86_cpuid"); |
| 6768 | 6756 | static inline uint32_t zig_e_zig_x86_get_xcr0(void) zig_mangled(zig_e_zig_x86_get_xcr0, "zig_x86_get_xcr0"); |