@@ -47,6 +47,7 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const {
47
47
return llvm::StringSwitch<bool >(Feature)
48
48
.Case (" simd128" , SIMDLevel >= SIMD128)
49
49
.Case (" relaxed-simd" , SIMDLevel >= RelaxedSIMD)
50
+ .Case (" half-precision" , HasHalfPrecision)
50
51
.Case (" nontrapping-fptoint" , HasNontrappingFPToInt)
51
52
.Case (" sign-ext" , HasSignExt)
52
53
.Case (" exception-handling" , HasExceptionHandling)
@@ -156,6 +157,7 @@ bool WebAssemblyTargetInfo::initFeatureMap(
156
157
Features[" reference-types" ] = true ;
157
158
Features[" sign-ext" ] = true ;
158
159
Features[" tail-call" ] = true ;
160
+ Features[" half-precision" ] = true ;
159
161
setSIMDLevel (Features, SIMD128, true );
160
162
} else if (CPU == " generic" ) {
161
163
Features[" mutable-globals" ] = true ;
@@ -216,6 +218,15 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
216
218
HasBulkMemory = false ;
217
219
continue ;
218
220
}
221
+ if (Feature == " +half-precision" ) {
222
+ SIMDLevel = std::max (SIMDLevel, SIMD128);
223
+ HasHalfPrecision = true ;
224
+ continue ;
225
+ }
226
+ if (Feature == " -half-precision" ) {
227
+ HasHalfPrecision = false ;
228
+ continue ;
229
+ }
219
230
if (Feature == " +atomics" ) {
220
231
HasAtomics = true ;
221
232
continue ;
0 commit comments