[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-08 Thread Lu Weining via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. SixWeining marked an inline comment as done. Closed by commit rGf62c9252fc0f: [LoongArch] Support -march=native and -mtune= (authored by SixWeining). Repository: rG

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-08 Thread Lu Weining via Phabricator via cfe-commits
SixWeining marked an inline comment as done. SixWeining added inline comments. Comment at: clang/lib/Basic/Targets/LoongArch.cpp:203 + StringRef ArchName = getCPU(); + Builder.defineMacro("__loongarch_arch", Twine("\"") + ArchName + Twine("\"")); + MaskRay

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-08 Thread Lu Weining via Phabricator via cfe-commits
SixWeining updated this revision to Diff 548442. SixWeining marked an inline comment as done. SixWeining added a comment. Address @MaskRay's comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155824/new/ https://reviews.llvm.org/D155824

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-08 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision. MaskRay added a comment. Some test suggestions Comment at: clang/lib/Basic/Targets/LoongArch.cpp:203 + StringRef ArchName = getCPU(); + Builder.defineMacro("__loongarch_arch", Twine("\"") + ArchName + Twine("\"")); + Use the

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-08 Thread Steven Wu via Phabricator via cfe-commits
steven_wu accepted this revision. steven_wu added a comment. In D155824#4568904 , @xen0n wrote: > This still LGTM, @steven_wu would you please take another look so this can > get re-landed if confirmed working? The driver part LGTM. Repository: rG

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-08 Thread WÁNG Xuěruì via Phabricator via cfe-commits
xen0n accepted this revision. xen0n added a comment. This revision is now accepted and ready to land. This still LGTM, @steven_wu would you please take another look so this can get re-landed if confirmed working? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-03 Thread Lu Weining via Phabricator via cfe-commits
SixWeining updated this revision to Diff 546766. SixWeining added a comment. rename the common helper to `postProcessTargetCPUString` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155824/new/ https://reviews.llvm.org/D155824 Files:

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-03 Thread Lu Weining via Phabricator via cfe-commits
SixWeining added inline comments. Comment at: clang/lib/Driver/ToolChains/Arch/LoongArch.cpp:199-204 + // Handle CPU name is 'native'. + if (CPU == "native") { +CPU = llvm::sys::getHostCPUName(); +if (CPU == "generic") + CPU =

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-03 Thread Lu Weining via Phabricator via cfe-commits
SixWeining updated this revision to Diff 546742. SixWeining marked an inline comment as done. SixWeining added a comment. Add a common helper for `-m{arch,tune}=native` handling. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155824/new/

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-03 Thread WÁNG Xuěruì via Phabricator via cfe-commits
xen0n added inline comments. Comment at: clang/lib/Driver/ToolChains/Arch/LoongArch.cpp:199-204 + // Handle CPU name is 'native'. + if (CPU == "native") { +CPU = llvm::sys::getHostCPUName(); +if (CPU == "generic") + CPU =

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-08-03 Thread Lu Weining via Phabricator via cfe-commits
SixWeining updated this revision to Diff 546730. SixWeining edited the summary of this revision. SixWeining added a comment. - work with `-fno-integrated-cc1` - add mingsing `"`s in macros Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155824/new/

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-31 Thread Steven Wu via Phabricator via cfe-commits
steven_wu added a comment. In D155824#4548921 , @SixWeining wrote: > In D155824#4548677 , @steven_wu > wrote: > >> After another look, I will need to request to revert this because this >> implementation

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-31 Thread Lu Weining via Phabricator via cfe-commits
SixWeining added a comment. In D155824#4548677 , @steven_wu wrote: > After another look, I will need to request to revert this because this > implementation doesn't work with `-fno-integrated-cc1` at all. You can't > setCPU/Tune in the driver into a

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-31 Thread Steven Wu via Phabricator via cfe-commits
steven_wu added a comment. After another look, I will need to request to revert this because this implementation doesn't work with `-fno-integrated-cc1` at all. You can't setCPU/Tune in the driver into a global variable and expect that will work during compilation. You can reproduce with

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-31 Thread Steven Wu via Phabricator via cfe-commits
steven_wu added inline comments. Comment at: llvm/lib/TargetParser/LoongArchTargetParser.cpp:19 +StringRef Arch; +StringRef TuneCPU; Why do we store `Arch` and `TuneCPU` as globals? We should not have as little global state in compiler as possible. Any reason

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-25 Thread Lu Weining via Phabricator via cfe-commits
SixWeining added inline comments. Comment at: clang/docs/ReleaseNotes.rst:138-143 +- Patchable function entry (``-fpatchable-function-entry``) is now supported + on LoongArch. +- Unaligned memory accesses can be toggled by ``-m[no-]unaligned-access`` or the + aliases

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-25 Thread Lu Weining via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG92c06114b2ea: [LoongArch] Support -march=native and -mtune= (authored by SixWeining). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-25 Thread Lu Weining via Phabricator via cfe-commits
SixWeining updated this revision to Diff 543941. SixWeining added a comment. add missing `.` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155824/new/ https://reviews.llvm.org/D155824 Files: clang/docs/ReleaseNotes.rst

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-25 Thread Lu Weining via Phabricator via cfe-commits
SixWeining updated this revision to Diff 543919. SixWeining added a comment. Address @xen0n's comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155824/new/ https://reviews.llvm.org/D155824 Files: clang/docs/ReleaseNotes.rst

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-25 Thread WÁNG Xuěruì via Phabricator via cfe-commits
xen0n accepted this revision. xen0n added a comment. This revision is now accepted and ready to land. Overall LGTM except one small nit, thanks! Comment at: clang/docs/ReleaseNotes.rst:902 like GCC does. +- Adds support for the ``-march=native`` and ``-mtune=`` options and

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-25 Thread Lu Weining via Phabricator via cfe-commits
SixWeining updated this revision to Diff 543902. SixWeining added a comment. update clang release notes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155824/new/ https://reviews.llvm.org/D155824 Files: clang/docs/ReleaseNotes.rst

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-24 Thread WÁNG Xuěruì via Phabricator via cfe-commits
xen0n added a comment. In D155824#4530474 , @SixWeining wrote: > @xen0n Do you have any inputs? I think supporting these options can improve > compatibility with gcc (although there is no ScheduleModel difference among > currently supported

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-24 Thread Lu Weining via Phabricator via cfe-commits
SixWeining added a comment. @xen0n Do you have any inputs? I think supporting these options can improve compatibility with gcc (although there is no ScheduleModel difference among currently supported processors) and I hope it can be merged into LLVM17. Repository: rG LLVM Github Monorepo

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-20 Thread Lu Weining via Phabricator via cfe-commits
SixWeining added a comment. > In GCC I added the numbers for "loongarch64" and "la464" although they are > the same, and GCC does not have "empty". But yes we can do things later here. Ah, I just realize `TuneCPU` is always not empty because: 27 LoongArchSubtarget

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-20 Thread Xi Ruoyao via Phabricator via cfe-commits
xry111 added a comment. In D155824#4521047 , @SixWeining wrote: > In D155824#4518597 , @xry111 wrote: > >> Do we need to convert Xuerui's label alignment change to use the -mtune >> framework? > > How to set

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-20 Thread Lu Weining via Phabricator via cfe-commits
SixWeining added a comment. In D155824#4518597 , @xry111 wrote: > Do we need to convert Xuerui's label alignment change to use the -mtune > framework? How to set the numbers if `TuneCPU` is empty? If there is no differences among `empty`,

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-20 Thread Xi Ruoyao via Phabricator via cfe-commits
xry111 added a comment. Do we need to convert Xuerui's label alignment change to use the -mtune framework? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155824/new/ https://reviews.llvm.org/D155824 ___

[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

2023-07-20 Thread Lu Weining via Phabricator via cfe-commits
SixWeining created this revision. SixWeining added reviewers: xen0n, xry111, hev, wangleiat. Herald added a subscriber: hiraditya. Herald added a project: All. SixWeining requested review of this revision. Herald added subscribers: llvm-commits, cfe-commits, MaskRay. Herald added projects: clang,