*To be tested by clang.
Details
Diff Detail
Event Timeline
There are two changes here: parse hwdiv and default hdiv.
The former looks good, the latter, not so much.
Please separate the patch in two and re-submit here only the parsing.
The default hwdiv will have to be implemented together with the other default flags, as we discussed earlier.
lib/Support/TargetParser.cpp | ||
---|---|---|
369 | oops |
So, overall looks ok.
AFAICT, these values are never used as is, to use in build attributes or somewhere else, so it should be safe to change their values to what we want.
Right now, the only uses of these are either to parse (string->ID) in Clang and the assembler and ID->string in ARMAsmPrinter.cpp, or to map them to build attribute flags in ARMAsmParser.cpp.
I don't know what default value you'd put on "idiv", but I'm guessing AEK_HWDIV would be the best choice.
cheers,
--renato
include/llvm/Support/TargetParser.h | ||
---|---|---|
137–141 | I'd put these ones at the end of the 32-bit range. | |
142 | you don't need AEK_LAST | |
lib/Support/TargetParser.cpp | ||
124 | you can't change this. This is the string that is supported by the command line and the assembler. The extensions supported by -mcpu here: https://sourceware.org/binutils/docs/as/ARM-Options.html are the same supported by the .arch_extension assembler directive. If this code passed the Clang tests, it means there aren't enough tests in there for these flags. |
ACLE 2.0 says __ARM_FEATURE_IDIV should be defined when both arm and thumb divide are supported. That's why I set the default value to (ARM::AEK_HWDIVARM | ARM::AEK_HWDIV)
lib/Support/TargetParser.cpp | ||
---|---|---|
123 | Let's keep these two out of it. This is a compatibility issue and we don't want to create more unnecessary divergence than we already have. This string will be parsed as "-mcpu=cpuname+idiv", but we already have the alternative (non-compatible) "-mhwdiv=arm/thumb", which already does what we need. | |
287 | Couldn't you just do something like: if (HWDivKind & ARM::AEK_HWDIV) Features.push_back("+hwdiv"); else Features.push_back("-hwdiv"); if (HWDivKind & ARM::AEK_HWDIVARM) Features.push_back("+hwdiv-arm"); else Features.push_back("-hwdiv-arm"); |
lib/Support/TargetParser.cpp | ||
---|---|---|
123 | The idea here was to be able to do what you suggested before http://reviews.llvm.org/D11299: void getDefaultFeatures(Features) { unsigned DefaultFeatures = getDefaultFeatures(CPUID); foreach (A: ARCHExtNames) if (DefaultFeatures & A.ID) Features[A.Name] = true; } Clang knows how to handle "+hwdiv-arm" and "+hwdiv" but not "+idiv" (at least in ARMTargetInfo). | |
287 | Sure. | |
407 | ARM::AEK_LAST no longer exists. I have to change this function to be iterative. Also add an equivalent function for getting HWDivName |
lib/Support/TargetParser.cpp | ||
---|---|---|
123 | That's different. +hwdiv ends up as a target-feature, and we're not parsing them. Besides, you're not using them in this patch, so it should not be added here, now. |
lib/Support/TargetParser.cpp | ||
---|---|---|
123 | I did not commit yet. Setting the ID to (ARM::AEK_HWDIVARM | ARM::AEK_HWDIV) causes regressions in llvm/tests. I think the reason is that in file lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp, getArchExtName() is called with ARM::AEK_HWDIV as argument, table lookup returns invalid and the function returns a null string. This is just one regression (CodeGen/ARM/krait-cpu-div-attribute.ll). There are more tests failing that I have not investigated yet. Shall I set ID to ARM::AEK_HWDIV as it was initially? |
lib/Support/TargetParser.cpp | ||
---|---|---|
123 | I think you can safely change ARMELFStreamer to emitArchExtension(HWDIV | HWDIVARM), since that's what it means. |
I'd put these ones at the end of the 32-bit range.