Lines Matching +full:loongson +full:- +full:1 +full:c

1 //===--- LoongArch.cpp - LoongArch Helpers for Tools ------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
30 // Record -mabi value for later use.
34 MABIValue = MABIArg->getValue();
37 // Parse -mfpu value for later use.
39 int FPU = -1;
41 StringRef V = MFPUArg->getValue();
52 // Check -m*-float firstly since they have highest priority.
57 int ImpliedFPU = -1;
58 if (A->getOption().matches(options::OPT_mdouble_float)) {
62 if (A->getOption().matches(options::OPT_msingle_float)) {
66 if (A->getOption().matches(options::OPT_msoft_float)) {
71 // Check `-mabi=` and `-mfpu=` settings and report if they conflict with
72 // the higher-priority settings implied by -m*-float.
78 << MABIArg->getAsString(Args) << A->getAsString(Args) << ImpliedABI;
80 if (FPU != -1 && ImpliedFPU != FPU)
82 << MFPUArg->getAsString(Args) << A->getAsString(Args) << ImpliedFPU;
87 // If `-mabi=` is specified, use it.
91 // Select abi based on -mfpu=xx.
111 // represent the {ILP32,LP64}D ABIs, but in Feb 2023 Loongson decided to
112 // drop the explicit suffix in favor of unmarked `-gnu` for the
113 // "general-purpose" ABIs, among other non-technical reasons.
130 // Enable the `lsx` feature on 64-bit LoongArch by default.
137 ArchName = A->getValue();
141 // Select floating-point features determined by -mdouble-float,
142 // -msingle-float, -msoft-float and -mfpu.
143 // Note: -m*-float wins any other options.
147 if (A->getOption().matches(options::OPT_mdouble_float)) {
150 } else if (A->getOption().matches(options::OPT_msingle_float)) {
152 Features.push_back("-d");
153 Features.push_back("-lsx");
154 } else /*Soft-float*/ {
155 Features.push_back("-f");
156 Features.push_back("-d");
157 Features.push_back("-lsx");
160 StringRef FPU = A->getValue();
166 Features.push_back("-d");
167 Features.push_back("-lsx");
169 Features.push_back("-f");
170 Features.push_back("-d");
171 Features.push_back("-lsx");
177 // Select the `ual` feature determined by -m[no-]strict-align.
183 A->ignoreTargetSpecific();
185 A->ignoreTargetSpecific();
187 A->ignoreTargetSpecific();
189 // Select lsx/lasx feature determined by -msimd=.
190 // Option -msimd= precedes -m[no-]lsx and -m[no-]lasx.
192 StringRef MSIMD = A->getValue();
194 // Option -msimd=lsx depends on 64-bit FPU.
195 // -m*-float and -mfpu=none/0/32 conflict with -msimd=lsx.
196 if (llvm::find(Features, "-d") != Features.end())
201 // Option -msimd=lasx depends on 64-bit FPU and LSX.
202 // -m*-float, -mfpu=none/0/32 and -mno-lsx conflict with -msimd=lasx.
203 if (llvm::find(Features, "-d") != Features.end())
204 D.Diag(diag::err_drv_loongarch_wrong_fpu_width) << /*LASX*/ 1;
205 else if (llvm::find(Features, "-lsx") != Features.end())
208 // The command options do not contain -mno-lasx.
215 Features.push_back("-lsx");
217 Features.push_back("-lasx");
223 // Select lsx feature determined by -m[no-]lsx.
225 // LSX depends on 64-bit FPU.
226 // -m*-float and -mfpu=none/0/32 conflict with -mlsx.
227 if (A->getOption().matches(options::OPT_mlsx)) {
228 if (llvm::find(Features, "-d") != Features.end())
230 else /*-mlsx*/
232 } else /*-mno-lsx*/ {
233 Features.push_back("-lsx");
237 // Select lasx feature determined by -m[no-]lasx.
240 // LASX depends on 64-bit FPU and LSX.
241 // -mno-lsx conflicts with -mlasx.
242 if (A->getOption().matches(options::OPT_mlasx)) {
243 if (llvm::find(Features, "-d") != Features.end())
244 D.Diag(diag::err_drv_loongarch_wrong_fpu_width) << /*LASX*/ 1;
245 else { /*-mlasx*/
249 } else /*-mno-lasx*/
250 Features.push_back("-lasx");
271 // If we have -march, use that.
273 Arch = A->getValue();
274 if (Arch == "la64v1.0" || Arch == "la64v1.1")