enable a disabled target feature through clang

My target has multiple flavors which implemented as features.

Having a hardware divider is an example of a feature. It is implemented in Escala.td as

def FeatureDiv : SubtargetFeature<“div”, “HasDiv”, “true”,
“Enable hardware divider”>;

def : Proc<“escala”, EscalaModel, [
FeatureDiv
]>;

I’ve added a an extra option to void Clang::AddEscalaTargetArgs(…) in clang/lib/Driver/Tools.cpp to handle enabling/disabling of this feature

if (Arg *A = Args.getLastArg(options::OPT_mhard_div,
options::OPT_msoft_div)) {
CmdArgs.push_back("-target-feature");
if (A->getOption().matches(options::OPT_mhard_div))
CmdArgs.push_back("+div");
else
CmdArgs.push_back("-div");
}

My expectation is that if I use -mhard-div the feature would be enabled and -msoft-div, it would be disabled. However I observed the following behavior.

If the feature is enabled (set to true) in Escala.td, ie.

def FeatureDiv : SubtargetFeature<“div”, “HasDiv”, “true”,
“Enable hardware divider”>;

then -mhard-div has no effect and -msoft-div disables the divider.

If the feature is disabled (set to false) in Escala.td, i.e.

def FeatureDiv : SubtargetFeature<“div”, “HasDiv”, “false”,
“Enable hardware divider”>;

then -mhard-div and -msoft-div have no effect. The compiler will automatically make an assumption to use a soft divider.

Here are my questions:

  1. Is this the intended behavior?
  2. If isn’t then how do I enable a disabled feature through a command line? In other words if a feature is disabled (set to false) in .td file, is it possible to enable it? For my specific case, if

def FeatureDiv : SubtargetFeature<“div”, “HasDiv”, “false”, // note “'false”
“Enable hardware divider”>;

is it possible to enable it through a command line?