This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Allow C++11 style initialisation of SVE types.
ClosedPublic

Authored by paulwalker-arm on Jun 22 2023, 8:25 AM.

Diff Detail

Event Timeline

paulwalker-arm created this revision.Jun 22 2023, 8:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 8:25 AM
paulwalker-arm requested review of this revision.Jun 22 2023, 8:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 8:25 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Moved C++ test into CodeGenCXX.

Renamed test.

Matt added a subscriber: Matt.Jun 22 2023, 4:16 PM
andrew added a subscriber: andrew.Jun 26 2023, 2:28 AM

With this I can build the Arm Compute Library for SVE with clang

efriedma added inline comments.Jun 26 2023, 9:21 AM
clang/lib/CodeGen/CGExprScalar.cpp
1878

I can see why you can't have more than one element... but both zero and one seem feasible. (For example, __SVInt8_t s8{__SVInt8_t{}};.)

paulwalker-arm added inline comments.Jun 26 2023, 9:30 AM
clang/lib/CodeGen/CGExprScalar.cpp
1878

I thought the same but anything more that zero triggers a cannot initialize a value of type '__SVFloat32_t' with an rvalue of type... compilation error message. Since I got the same error with gcc I didn't dig any deeper.

efriedma added inline comments.Jun 26 2023, 9:33 AM
clang/lib/CodeGen/CGExprScalar.cpp
1878

Let me put it this way: the following crashes on main, and this patch doesn't address it.

void test_locals(__SVInt8_t x) {
  __SVInt8_t s8{x};
}
paulwalker-arm added inline comments.Jun 26 2023, 9:35 AM
clang/lib/CodeGen/CGExprScalar.cpp
1878

Oh, sorry, I misread the previous example.

Rebased and updated to allow copy initialisation.

This revision is now accepted and ready to land.Jun 27 2023, 10:17 AM
This revision was landed with ongoing or failed builds.Jun 29 2023, 5:17 AM
This revision was automatically updated to reflect the committed changes.