This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Implemented mtmsr, mfspr, mtspr Builtins
ClosedPublic

Authored by Conanap on Jul 16 2021, 12:17 AM.

Details

Summary

Implemented builtins for mtmsr, mfspr, mtspr on PowerPC;
the patch is intended for XL Compatibility.

Diff Detail

Event Timeline

Conanap created this revision.Jul 16 2021, 12:17 AM
Conanap requested review of this revision.Jul 16 2021, 12:17 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 16 2021, 12:17 AM
Conanap updated this revision to Diff 359236.Jul 16 2021, 12:32 AM

Added sema checking

nemanjai requested changes to this revision.Jul 16 2021, 5:24 AM

Why does this review have no reviewers listed?

clang/lib/CodeGen/CGBuiltin.cpp
15694

Is this the formatting that clang-format produces? Seems surprising it would format it that way.

clang/lib/Sema/SemaChecking.cpp
3374 ↗(On Diff #359236)

I don't think we should enforce the range. The architecture may add more SPR's in the future and then this check will need to be updated. Just ensure that the register number (as well as the value for mtspr) are constants.

llvm/include/llvm/IR/IntrinsicsPowerPC.td
1579

Nit: line too long

llvm/lib/Target/PowerPC/PPCInstr64Bit.td
497

Unrelated whitespace change.

llvm/lib/Target/PowerPC/PPCInstrInfo.td
5486

Shouldn't this be imm instead of i32?
Have you tried compiling the test cases with -filetype=obj and/or with -ppc-asm-full-reg-names?

This revision now requires changes to proceed.Jul 16 2021, 5:24 AM
Conanap updated this revision to Diff 359400.Jul 16 2021, 11:37 AM
Conanap marked 4 inline comments as done.

Changed i32 to timm for patterns, some nits

clang/lib/CodeGen/CGBuiltin.cpp
15694

I ran git clang-format HEAD^ and it didn't change it, so seems like it was happy with this.

Could you please add a check for constant arguments to clang/test/CodeGen/builtins-ppc-xlcompat-error.c?

Conanap updated this revision to Diff 359424.Jul 16 2021, 1:12 PM

added an error test

nemanjai accepted this revision.Jul 18 2021, 3:07 PM

LGTM.

This revision is now accepted and ready to land.Jul 18 2021, 3:07 PM
lei added a subscriber: lei.Jul 19 2021, 6:41 AM
lei added inline comments.
llvm/test/CodeGen/builtins-ppc-xlcompat-move-tofrom-regs.ll
3 ↗(On Diff #359424)

No need to add this NOTE. Just remove the atuo generate line above.

This revision was landed with ongoing or failed builds.Jul 20 2021, 4:00 PM
This revision was automatically updated to reflect the committed changes.