This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Add PowerPC "__stbcx" builtin and intrinsic for XL compatibility
ClosedPublic

Authored by NeHuang on Jul 21 2021, 12:54 PM.

Details

Summary

This patch is in a series of patches to provide builtins for compatibility with the XL compiler.
This patch adds the builtin and intrinsic for "__stbcx".

Diff Detail

Event Timeline

NeHuang created this revision.Jul 21 2021, 12:54 PM
NeHuang requested review of this revision.Jul 21 2021, 12:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2021, 12:54 PM
lei added a subscriber: lei.Jul 21 2021, 4:28 PM
lei added inline comments.
clang/include/clang/Basic/BuiltinsPPC.def
116

maybe move this up to where __builtin_ppc_stdcx is defined. To match what you did in PPC.cpp

clang/test/CodeGen/builtins-ppc-xlcompat-pwr8.c
31

Why not just add this tc to clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c?
The other related store functions are tested there.

NeHuang updated this revision to Diff 360803.Jul 22 2021, 7:14 AM
  • Addressed review comments from Lei
  • Rebased the patch
NeHuang marked an inline comment as done.Jul 22 2021, 7:16 AM
NeHuang added inline comments.
clang/test/CodeGen/builtins-ppc-xlcompat-pwr8.c
31

__stbcx is only valid with pwr8 (or later cpu)

NeHuang marked an inline comment as done.Jul 22 2021, 7:16 AM
nemanjai accepted this revision.Jul 22 2021, 7:29 AM

LGTM aside from a small nit.

clang/lib/Basic/Targets/PPC.cpp
121

Nit: move just under sthcx so the order makes sense: doubleword, word, haflword, byte.

This revision is now accepted and ready to land.Jul 22 2021, 7:29 AM
Conanap added inline comments.
clang/lib/Sema/SemaChecking.cpp
3432

would prefer if this joined the list of sthcx, lharx and lbarx right below this case

This revision was landed with ongoing or failed builds.Jul 22 2021, 8:49 AM
This revision was automatically updated to reflect the committed changes.
NeHuang marked an inline comment as done.