This is an archive of the discontinued LLVM Phabricator instance.

[Clang][RISCV] Guard vector int64, float32, float64 with semantic analysis
ClosedPublic

Authored by eopXD on Feb 9 2023, 10:15 AM.

Diff Detail

Event Timeline

eopXD created this revision.Feb 9 2023, 10:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 9 2023, 10:15 AM
eopXD requested review of this revision.Feb 9 2023, 10:15 AM
eopXD updated this revision to Diff 496185.Feb 9 2023, 10:56 AM

Bump CI.

craig.topper added inline comments.Feb 9 2023, 1:37 PM
clang/include/clang/AST/Type.h
7209

This function is RVV specific so it's name is misleading. It's also identical to the isRVVFloat32Type function

clang/include/clang/Basic/TargetInfo.h
668

Having a different virtual method for each type doesn't scale well. Could we have a single function that take the bitwidth and a bool for int or FP?

It's also very misleading based on the current names to return false for targets like X86 that do support float32 and float64.

Overall it might be cleaner to call S.Context.getTargetInfo().hasFeature( from RISCV-V specific code in Sema instead of trying to define a generic interface.

eopXD added inline comments.Feb 9 2023, 5:39 PM
clang/include/clang/Basic/TargetInfo.h
668

It's also very misleading based on the current names to return false for targets like X86 that do support float32 and float64.

This is the base class of TargetInfo, we may add code under x86 to override it.

eopXD added inline comments.Feb 9 2023, 5:46 PM
clang/lib/Sema/Sema.cpp
2049–2056

Overall it might be cleaner to call S.Context.getTargetInfo().hasFeature( from RISCV-V specific code in Sema instead of trying to define a generic interface.

If so, we will have something like:

if (Ty->isRVVInt64Type() && !Context.getTargetInfo().hasFeature("zve64x")) {
  Diag(Loc, diag::err_riscv_type_requires_extension, FD) << Ty << "zve64x";
}

I don't have a preference here, if this matches your expectation, I will update the revision this way.

craig.topper added inline comments.Feb 10 2023, 9:32 PM
clang/lib/Sema/Sema.cpp
2049–2056

I'm ok with what you did the Zvfh patch.

eopXD updated this revision to Diff 497223.Feb 14 2023, 12:09 AM

Update code.

eopXD marked an inline comment as done.Feb 14 2023, 12:09 AM
eopXD updated this revision to Diff 497224.Feb 14 2023, 12:11 AM

Update code.

This revision is now accepted and ready to land.Feb 14 2023, 11:19 AM
This revision was landed with ongoing or failed builds.Feb 14 2023, 5:38 PM
This revision was automatically updated to reflect the committed changes.