"%0 is unsupported with RISC-V linker relaxation (-mrelax)">;
def err_drv_loongarch_invalid_mfpu_EQ : Error<
- "invalid argument '%0' to -mfpu=; must be one of: 64, 32, 0, none">;
+ "invalid argument '%0' to -mfpu=; must be one of: 64, 32, none, 0 (alias for none)">;
}
// LA32-NOT: "target-features"=
// LA64: "target-features"="+64bit,+d,+f"
-/// Dummy function
int foo(void) {
- return 3;
+ return 3;
}
-// RUN: not %clang --target=loongarch64 -march=loongarch -fsyntax-only %s 2>&1 \
-// RUN: | FileCheck --check-prefix=LOONGARCH %s
+// RUN: not %clang --target=loongarch64 -march=loongarch -fsyntax-only %s 2>&1 | \
+// RUN: FileCheck --check-prefix=LOONGARCH %s
// LOONGARCH: error: invalid arch name '-march=loongarch'
-// RUN: not %clang --target=loongarch64 -march=LA464 -fsyntax-only %s 2>&1 \
-// RUN: | FileCheck --check-prefix=LA464-UPPER %s
+// RUN: not %clang --target=loongarch64 -march=LA464 -fsyntax-only %s 2>&1 | \
+// RUN: FileCheck --check-prefix=LA464-UPPER %s
// LA464-UPPER: error: invalid arch name '-march=LA464'
-// RUN: %clang --target=loongarch64 -march=loongarch64 -fsyntax-only %s -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CC1-LOONGARCH64
-// RUN: %clang --target=loongarch64 -march=la464 -fsyntax-only %s -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CC1-LA464
-// RUN: %clang --target=loongarch64 -march=loongarch64 -S -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=IR-LOONGARCH64
-// RUN: %clang --target=loongarch64 -march=la464 -S -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=IR-LA464
+// RUN: %clang --target=loongarch64 -march=loongarch64 -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefix=CC1-LOONGARCH64
+// RUN: %clang --target=loongarch64 -march=la464 -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefix=CC1-LA464
+// RUN: %clang --target=loongarch64 -march=loongarch64 -S -emit-llvm %s -o - | \
+// RUN: FileCheck %s --check-prefix=IR-LOONGARCH64
+// RUN: %clang --target=loongarch64 -march=la464 -S -emit-llvm %s -o - | \
+// RUN: FileCheck %s --check-prefix=IR-LA464
// CC1-LOONGARCH64-NOT: "-target-feature"
-// CC1-LOONGARCH64: "-target-feature" "+64bit"
-// CC1-LOONGARCH64-SAME: {{^}} "-target-feature" "+f"
-// CC1-LOONGARCH64-SAME: {{^}} "-target-feature" "+d"
+// CC1-LOONGARCH64: "-target-feature" "+64bit" "-target-feature" "+f" "-target-feature" "+d"
// CC1-LOONGARCH64-NOT: "-target-feature"
// CC1-LOONGARCH64: "-target-abi" "lp64d"
// CC1-LA464-NOT: "-target-feature"
-// CC1-LA464: "-target-feature" "+64bit"
-// CC1-LA464-SAME: {{^}} "-target-feature" "+f"
-// CC1-LA464-SAME: {{^}} "-target-feature" "+d"
-// CC1-LA464-SAME: {{^}} "-target-feature" "+lsx"
-// CC1-LA464-SAME: {{^}} "-target-feature" "+lasx"
+// CC1-LA464: "-target-feature" "+64bit" "-target-feature" "+f" "-target-feature" "+d" "-target-feature" "+lsx" "-target-feature" "+lasx"
// CC1-LA464-NOT: "-target-feature"
// CC1-LA464: "-target-abi" "lp64d"
-// IR-LOONGARCH64: attributes #{{[0-9]+}} ={{.*}}"target-features"="+64bit,+d,+f"
-// IR-LA464: attributes #{{[0-9]+}} ={{.*}}"target-features"="+64bit,+d,+f,+lasx,+lsx"
+// IR-LOONGARCH64: attributes #[[#]] ={{.*}}"target-features"="+64bit,+d,+f"
+// IR-LA464: attributes #[[#]] ={{.*}}"target-features"="+64bit,+d,+f,+lasx,+lsx"
-/// Dummy function
int foo(void) {
- return 3;
+ return 3;
}
-// RUN: %clang --target=loongarch64 -mdouble-float -fsyntax-only %s -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CC1
-// RUN: %clang --target=loongarch64 -mdouble-float -S -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=IR
+// RUN: %clang --target=loongarch64 -mdouble-float -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefix=CC1
+// RUN: %clang --target=loongarch64 -mdouble-float -mfpu=0 -mabi=lp64s -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefixes=CC1,WARN
+// RUN: %clang --target=loongarch64 -mdouble-float -S -emit-llvm %s -o - | \
+// RUN: FileCheck %s --check-prefix=IR
+
+// WARN: warning: argument unused during compilation: '-mfpu=0'
+// WARN: warning: argument unused during compilation: '-mabi=lp64s'
// CC1-NOT: "-target-feature"
-// CC1: "-target-feature" "+64bit"
-// CC1-SAME: {{^}} "-target-feature" "+f"
-// CC1-SAME: {{^}} "-target-feature" "+d"
+// CC1: "-target-feature" "+64bit" "-target-feature" "+f" "-target-feature" "+d"
// CC1-NOT: "-target-feature"
// CC1: "-target-abi" "lp64d"
-// IR: attributes #{{[0-9]+}} ={{.*}}"target-features"="+64bit,+d,+f"
+// IR: attributes #[[#]] ={{.*}}"target-features"="+64bit,+d,+f"
-/// Dummy function
int foo(void) {
- return 3;
+ return 3;
}
-// RUN: %clang --target=loongarch64 -mfpu=xxx -fsyntax-only %s -### 2>&1 \
-// RUN: | FileCheck %s
+// RUN: %clang --target=loongarch64 -mfpu=xxx %s -### 2>&1 | FileCheck %s
-// CHECK: invalid argument 'xxx' to -mfpu=; must be one of: 64, 32, 0, none
+// CHECK: invalid argument 'xxx' to -mfpu=; must be one of: 64, 32, none, 0 (alias for none)
-// RUN: %clang --target=loongarch64 -mfpu=64 -fsyntax-only %s -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CC1-FPU64
-// RUN: %clang --target=loongarch64 -mfpu=32 -fsyntax-only %s -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CC1-FPU32
-// RUN: %clang --target=loongarch64 -mfpu=0 -fsyntax-only %s -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CC1-FPU0
-// RUN: %clang --target=loongarch64 -mfpu=none -fsyntax-only %s -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CC1-FPU0
+// RUN: %clang --target=loongarch64 -mfpu=64 -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefix=CC1-FPU64
+// RUN: %clang --target=loongarch64 -mfpu=32 -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefix=CC1-FPU32
+// RUN: %clang --target=loongarch64 -mfpu=0 -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefix=CC1-FPU0
+// RUN: %clang --target=loongarch64 -mfpu=none -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefix=CC1-FPU0
-// RUN: %clang --target=loongarch64 -mfpu=64 -S -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=IR-FPU64
-// RUN: %clang --target=loongarch64 -mfpu=32 -S -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=IR-FPU32
-// RUN: %clang --target=loongarch64 -mfpu=0 -S -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=IR-FPU0
-// RUN: %clang --target=loongarch64 -mfpu=none -S -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=IR-FPU0
+// RUN: %clang --target=loongarch64 -mfpu=64 -S -emit-llvm %s -o - | \
+// RUN: FileCheck %s --check-prefix=IR-FPU64
+// RUN: %clang --target=loongarch64 -mfpu=32 -S -emit-llvm %s -o - | \
+// RUN: FileCheck %s --check-prefix=IR-FPU32
+// RUN: %clang --target=loongarch64 -mfpu=0 -S -emit-llvm %s -o - | \
+// RUN: FileCheck %s --check-prefix=IR-FPU0
+// RUN: %clang --target=loongarch64 -mfpu=none -S -emit-llvm %s -o - | \
+// RUN: FileCheck %s --check-prefix=IR-FPU0
// CC1-FPU64-NOT: "-target-feature"
-// CC1-FPU64: "-target-feature" "+64bit"
-// CC1-FPU64-SAME: "-target-feature" "+f"
-// CC1-FPU64-SAME: "-target-feature" "+d"
+// CC1-FPU64: "-target-feature" "+64bit" "-target-feature" "+f" "-target-feature" "+d"
// CC1-FPU64-NOT: "-target-feature"
// CC1-FPU64: "-target-abi" "lp64d"
// CC1-FPU32-NOT: "-target-feature"
-// CC1-FPU32: "-target-feature" "+64bit"
-// CC1-FPU32-SAME: "-target-feature" "+f"
-// CC1-FPU32-SAME: "-target-feature" "-d"
+// CC1-FPU32: "-target-feature" "+64bit" "-target-feature" "+f" "-target-feature" "-d"
// CC1-FPU32-NOT: "-target-feature"
// CC1-FPU32: "-target-abi" "lp64f"
// CC1-FPU0-NOT: "-target-feature"
-// CC1-FPU0: "-target-feature" "+64bit"
-// CC1-FPU0-SAME: "-target-feature" "-f"
-// CC1-FPU0-SAME: "-target-feature" "-d"
+// CC1-FPU0: "-target-feature" "+64bit" "-target-feature" "-f" "-target-feature" "-d"
// CC1-FPU0-NOT: "-target-feature"
// CC1-FPU0: "-target-abi" "lp64s"
-// IR-FPU64: attributes #{{[0-9]+}} ={{.*}}"target-features"="+64bit,+d,+f"
-// IR-FPU32: attributes #{{[0-9]+}} ={{.*}}"target-features"="+64bit,+f,-d"
-// IR-FPU0: attributes #{{[0-9]+}} ={{.*}}"target-features"="+64bit,-d,-f"
+// IR-FPU64: attributes #[[#]] ={{.*}}"target-features"="+64bit,+d,+f"
+// IR-FPU32: attributes #[[#]] ={{.*}}"target-features"="+64bit,+f,-d"
+// IR-FPU0: attributes #[[#]] ={{.*}}"target-features"="+64bit,-d,-f"
-/// Dummy function
int foo(void) {
- return 3;
+ return 3;
}
-// RUN: %clang --target=loongarch64 -msingle-float -fsyntax-only %s -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CC1
-// RUN: %clang --target=loongarch64 -msingle-float -S -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=IR
+// RUN: %clang --target=loongarch64 -msingle-float -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefix=CC1
+// RUN: %clang --target=loongarch64 -msingle-float -mfpu=0 -mabi=lp64s -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefixes=CC1,WARN
+// RUN: %clang --target=loongarch64 -msingle-float -S -emit-llvm %s -o - | \
+// RUN: FileCheck %s --check-prefix=IR
+
+// WARN: warning: argument unused during compilation: '-mfpu=0'
+// WARN: warning: argument unused during compilation: '-mabi=lp64s'
// CC1-NOT: "-target-feature"
-// CC1: "-target-feature" "+64bit"
-// CC1-SAME: {{^}} "-target-feature" "+f"
-// CC1-SAME: {{^}} "-target-feature" "-d"
+// CC1: "-target-feature" "+64bit" "-target-feature" "+f" "-target-feature" "-d"
// CC1-NOT: "-target-feature"
// CC1: "-target-abi" "lp64f"
-// IR: attributes #{{[0-9]+}} ={{.*}}"target-features"="+64bit,+f,-d"
+// IR: attributes #[[#]] ={{.*}}"target-features"="+64bit,+f,-d"
-/// Dummy function
int foo(void) {
- return 3;
+ return 3;
}
-// RUN: %clang --target=loongarch64 -msoft-float -fsyntax-only %s -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CC1
-// RUN: %clang --target=loongarch64 -msoft-float -S -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=IR
+// RUN: %clang --target=loongarch64 -msoft-float -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefix=CC1
+// RUN: %clang --target=loongarch64 -msoft-float -mfpu=64 -mabi=lp64d -fsyntax-only %s -### 2>&1 | \
+// RUN: FileCheck %s --check-prefixes=CC1,WARN
+// RUN: %clang --target=loongarch64 -msoft-float -S -emit-llvm %s -o - | \
+// RUN: FileCheck %s --check-prefix=IR
+
+// WARN: warning: argument unused during compilation: '-mfpu=64'
+// WARN: warning: argument unused during compilation: '-mabi=lp64d'
// CC1-NOT: "-target-feature"
-// CC1: "-target-feature" "+64bit"
-// CC1-SAME: {{^}} "-target-feature" "-f"
-// CC1-SAME: {{^}} "-target-feature" "-d"
+// CC1: "-target-feature" "+64bit" "-target-feature" "-f" "-target-feature" "-d"
// CC1-NOT: "-target-feature"
// CC1: "-target-abi" "lp64s"
-// IR: attributes #{{[0-9]+}} ={{.*}}"target-features"="+64bit,-d,-f"
+// IR: attributes #[[#]] ={{.*}}"target-features"="+64bit,-d,-f"
-/// Dummy function
int foo(void) {
- return 3;
+ return 3;
}
};
LoongArch::ArchKind LoongArch::parseArch(StringRef Arch) {
- for (const auto A : AllArchs) {
+ for (const auto A : AllArchs)
if (A.Name == Arch)
return A.Kind;
- }
return LoongArch::ArchKind::AK_INVALID;
}
std::vector<StringRef> &Features) {
for (const auto A : AllArchs) {
if (A.Name == Arch) {
- for (const auto F : AllFeatures) {
- if ((A.Features & F.Kind) == F.Kind && F.Kind != FK_INVALID) {
+ for (const auto F : AllFeatures)
+ if ((A.Features & F.Kind) == F.Kind && F.Kind != FK_INVALID)
Features.push_back(F.Name);
- }
- }
return true;
}
}