Skip to content

Commit

Permalink
Add appropriate mattrs for arm-32 extensions (#7978)
Browse files Browse the repository at this point in the history
* Add appropriate mattrs for arm-32 extensions

Fixes #7976

* Pull clauses out of if
  • Loading branch information
abadams authored and vksnk committed Dec 7, 2023
1 parent b5cb8f3 commit 40ea449
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions src/CodeGen_ARM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1647,48 +1647,46 @@ string CodeGen_ARM::mcpu_tune() const {
}

string CodeGen_ARM::mattrs() const {
string arch_flags;
string separator;
if (target.has_feature(Target::ARMFp16)) {
arch_flags += separator + "+fullfp16";
separator = ",";
}
if (target.has_feature(Target::ARMv81a)) {
arch_flags += separator + "+v8.1a";
separator = ",";
}
if (target.has_feature(Target::ARMDotProd)) {
arch_flags += separator + "+dotprod";
separator = ",";
}
if (target.bits == 32) {
if (target.has_feature(Target::ARMv7s)) {
return "+neon";
arch_flags += separator + "+neon";
separator = ",";
}
if (!target.has_feature(Target::NoNEON)) {
return "+neon";
arch_flags += separator + "+neon";
separator = ",";
} else {
return "-neon";
arch_flags += separator + "-neon";
separator = ",";
}
} else {
// TODO: Should Halide's SVE flags be 64-bit only?
string arch_flags;
string separator;
if (target.has_feature(Target::SVE2)) {
arch_flags = "+sve2";
separator = ",";
} else if (target.has_feature(Target::SVE)) {
arch_flags = "+sve";
separator = ",";
}

if (target.has_feature(Target::ARMv81a)) {
arch_flags += separator + "+v8.1a";
separator = ",";
}

if (target.has_feature(Target::ARMDotProd)) {
arch_flags += separator + "+dotprod";
separator = ",";
}

if (target.has_feature(Target::ARMFp16)) {
arch_flags += separator + "+fullfp16";
separator = ",";
}

if (target.os == Target::IOS || target.os == Target::OSX) {
return arch_flags + separator + "+reserve-x18";
} else {
return arch_flags;
arch_flags += separator + "+reserve-x18";
}
}
return arch_flags;
}

bool CodeGen_ARM::use_soft_float_abi() const {
Expand Down

0 comments on commit 40ea449

Please sign in to comment.