This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Implement XL compact math builtins
ClosedPublic

Authored by lei on Jul 13 2021, 12:39 PM.

Details

Summary

Implement a subset of builtins required for compatiblilty with AIX XL compiler.

Diff Detail

Event Timeline

lei created this revision.Jul 13 2021, 12:39 PM
lei requested review of this revision.Jul 13 2021, 12:39 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 13 2021, 12:39 PM
lei updated this revision to Diff 358409.Jul 13 2021, 1:17 PM

update tc to only check for pwr7 and up

nemanjai added inline comments.
llvm/lib/Target/PowerPC/PPCInstrInfo.td
3092

I think we should conservatively set RM as an implicit def here. @ZhangKang you modified this code most recently, please provide your opinion here.

lei updated this revision to Diff 358665.Jul 14 2021, 10:53 AM

cleanup tests

nemanjai requested changes to this revision.Jul 14 2021, 11:28 AM

Please change compact in the title to compat.

clang/include/clang/Basic/BuiltinsPPC.def
78–81

I think at least some of these should be I because the parameter must be foldable to an integer constant expression (see Builtins.def).

llvm/include/llvm/IR/IntrinsicsPowerPC.td
1588

For parameters that need to be immediates, please mark them as such with the respective intrinsic property.

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

Please review the order of operands carefully here. I believe the order is wrong either for this one or for the VSX version. Double-check all of the others as well please.

llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-math.ll
3

Please add -mattr=-vsx to one of the run lines since you have added patterns for non-VSX but do not appear to be testing that code path.

This revision now requires changes to proceed.Jul 14 2021, 11:28 AM
lei updated this revision to Diff 359050.Jul 15 2021, 10:55 AM
lei marked 3 inline comments as done.

Address review comments to add/upate:

  • builtin encoding for params that need to be folded into constant expr
  • llvm intrinsic property for immediates
  • test line for -mattr=-vsx
llvm/lib/Target/PowerPC/PPCInstrInfo.td
3655

I double checked and both seem correct to me.

lei updated this revision to Diff 359070.Jul 15 2021, 11:35 AM

rebase to ToT

nemanjai accepted this revision.Jul 15 2021, 1:11 PM

LGTM other than the comment that wasn't addressed (which I assume will be addressed in a subsequent patch).

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

This was not addressed. Will this be added in a follow-up patch?

This revision is now accepted and ready to land.Jul 15 2021, 1:11 PM
lei added inline comments.Jul 16 2021, 6:48 AM
llvm/lib/Target/PowerPC/PPCInstrInfo.td
3092

Yes, sorry I will address this in a subsequent patch since adding RM will cause unrelated LIT failures.

This revision was landed with ongoing or failed builds.Jul 16 2021, 11:21 AM
This revision was automatically updated to reflect the committed changes.