This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbd30d4be2354: [Driver] Add f16 support to -mrecip parsing.
(authored by craig.topper).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124551/new/
https://reviews.llvm.org/D124551
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGen/attr-mrecip.c
clang/test/Driver/mrecip.c
Index: clang/test/Driver/mrecip.c
===================================================================
--- clang/test/Driver/mrecip.c
+++ clang/test/Driver/mrecip.c
@@ -37,6 +37,9 @@
// RUN: %clang -### -S %s -mrecip=divf,sqrtd,vec-divd,vec-sqrtf 2>&1 | FileCheck --check-prefix=RECIP8 %s
// RECIP8: "-mrecip=divf,sqrtd,vec-divd,vec-sqrtf"
+// RUN: %clang -### -S %s -mrecip=vec-sqrth 2>&1 | FileCheck --check-prefix=RECIP18 %s
+// RECIP18: "-mrecip=vec-sqrth"
+
//// Check optional refinement step specifiers.
// RUN: %clang -### -S %s -mrecip=all:1 2>&1 | FileCheck --check-prefix=RECIP9 %s
@@ -51,6 +54,9 @@
// RUN: %clang -### -S %s -mrecip=divd:1,!sqrtf:2,vec-divf:9,vec-sqrtd:0 2>&1 | FileCheck --check-prefix=RECIP12 %s
// RECIP12: "-mrecip=divd:1,!sqrtf:2,vec-divf:9,vec-sqrtd:0"
+// RUN: %clang -### -S %s -mrecip=sqrth:2 2>&1 | FileCheck --check-prefix=RECIP19 %s
+// RECIP19: "-mrecip=sqrth:2"
+
//// Check invalid parameters.
// RUN: %clang -### -S %s -mrecip=bogus 2>&1 | FileCheck --check-prefix=RECIP13 %s
@@ -68,3 +74,11 @@
// RUN: %clang -### -S %s -mrecip=!vec-divd: 2>&1 | FileCheck --check-prefix=RECIP17 %s
// RECIP17: error: invalid value
+// RUN: %clang -### -S %s -mrecip=divh:1,divh 2>&1 | FileCheck --check-prefix=RECIP20 %s
+// RECIP20: error: invalid value
+
+// RUN: %clang -### -S %s -mrecip=divh,div 2>&1 | FileCheck --check-prefix=RECIP21 %s
+// RECIP21: error: invalid value
+
+// RUN: %clang -### -S %s -mrecip=sqrt,sqrth 2>&1 | FileCheck --check-prefix=RECIP22 %s
+// RECIP22: error: invalid value
Index: clang/test/CodeGen/attr-mrecip.c
===================================================================
--- clang/test/CodeGen/attr-mrecip.c
+++ clang/test/CodeGen/attr-mrecip.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -mrecip=!sqrtf,vec-divf:3 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -mrecip=!sqrtf,vec-divf:3,divh -emit-llvm %s -o - | FileCheck %s
int baz(int a) { return 4; }
// CHECK: baz{{.*}} #0
-// CHECK: #0 = {{.*}}"reciprocal-estimates"="!sqrtf,vec-divf:3"
+// CHECK: #0 = {{.*}}"reciprocal-estimates"="!sqrtf,vec-divf:3,divh"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -226,12 +226,16 @@
llvm::StringMap<bool> OptionStrings;
OptionStrings.insert(std::make_pair("divd", false));
OptionStrings.insert(std::make_pair("divf", false));
+ OptionStrings.insert(std::make_pair("divh", false));
OptionStrings.insert(std::make_pair("vec-divd", false));
OptionStrings.insert(std::make_pair("vec-divf", false));
+ OptionStrings.insert(std::make_pair("vec-divh", false));
OptionStrings.insert(std::make_pair("sqrtd", false));
OptionStrings.insert(std::make_pair("sqrtf", false));
+ OptionStrings.insert(std::make_pair("sqrth", false));
OptionStrings.insert(std::make_pair("vec-sqrtd", false));
OptionStrings.insert(std::make_pair("vec-sqrtf", false));
+ OptionStrings.insert(std::make_pair("vec-sqrth", false));
for (unsigned i = 0; i != NumOptions; ++i) {
StringRef Val = A->getValue(i);
@@ -255,10 +259,11 @@
D.Diag(diag::err_drv_unknown_argument) << Val;
return;
}
- // The option was specified without a float or double suffix.
- // Make sure that the double entry was not already specified.
+ // The option was specified without a half or float or double suffix.
+ // Make sure that the double or half entry was not already specified.
// The float entry will be checked below.
- if (OptionStrings[ValBase.str() + 'd']) {
+ if (OptionStrings[ValBase.str() + 'd'] ||
+ OptionStrings[ValBase.str() + 'h']) {
D.Diag(diag::err_drv_invalid_value) << A->getOption().getName() << Val;
return;
}
@@ -273,9 +278,12 @@
// Mark the matched option as found. Do not allow duplicate specifiers.
OptionIter->second = true;
- // If the precision was not specified, also mark the double entry as found.
- if (ValBase.back() != 'f' && ValBase.back() != 'd')
+ // If the precision was not specified, also mark the double and half entry
+ // as found.
+ if (ValBase.back() != 'f' && ValBase.back() != 'd' && ValBase.back() != 'h') {
OptionStrings[ValBase.str() + 'd'] = true;
+ OptionStrings[ValBase.str() + 'h'] = true;
+ }
// Build the output string.
StringRef Prefix = IsDisabled ? DisabledPrefixOut : EnabledPrefixOut;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits