Page MenuHomePhabricator

[PowerPC] Add PowerPC compare and multiply related builtins and instrinsics for XL compatibility

Authored by NeHuang on May 20 2021, 2:21 PM.



This patch is in a series of patches to provide builtins for compatibility
with the XL compiler. This patch adds the builtins and instrisics for compare
and multiply related operations.

Diff Detail

Event Timeline

NeHuang created this revision.May 20 2021, 2:21 PM
NeHuang requested review of this revision.May 20 2021, 2:21 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 20 2021, 2:21 PM
NeHuang edited the summary of this revision. (Show Details)May 20 2021, 2:23 PM
NeHuang added reviewers: nemanjai, stefanp, Restricted Project.
NeHuang updated this revision to Diff 350991.Jun 9 2021, 5:40 PM
  • Renamed the XLCompat builtin as __builtin_ppc_* and add them to definedXLCompatMacros and update the test cases.
  • Report error in SemaChecking when 64 bit only builtins run on a 32 bit target and update the test cases.
  • Move the XLCompat Intrinsics definition under
let TargetPrefix = "ppc" in {
NeHuang updated this revision to Diff 351989.Jun 14 2021, 1:49 PM

Rebased the patch with changes in

NeHuang updated this revision to Diff 352560.Jun 17 2021, 6:49 AM
  • Add AIX 32&64 bit run line checks (front and back end test cases)
  • Create builtin-ppc-xlcompat-error.c for arguments related error check, add error test case for __builtin_ppc_cmprb
  • Remove 32 bit linux run line checks
  • Update bulitin test cases to remove redundant definitions.
lei added a subscriber: lei.Jun 17 2021, 7:08 AM
lei added inline comments.
354 ↗(On Diff #352560)

Can you pleases rebase your patch again? The removal of this function was part of D104125.

2 ↗(On Diff #352560)

Are these pwr9 specific as well? If not please targe pwr7 for big endian and pwr8 for little endian


same comment as above.

lei added inline comments.Jun 17 2021, 11:47 AM
6 ↗(On Diff #352560)

why not just use default for 64BIT behaviour? No need for --check-prefix=CHECK-64

lei added inline comments.Jun 17 2021, 11:49 AM
8 ↗(On Diff #352560)

-check-prefix=CHECK-32 => --check-prefix=CHECK-32

NeHuang updated this revision to Diff 354081.EditedJun 23 2021, 2:34 PM
  • Added Sema check for the pwr9 only and 64 bit only builtins and updated the test cases.
  • Rebased the patch with ToT.
  • Cleaned up the test cases and address review comments
NeHuang marked an inline comment as done.Jun 23 2021, 2:36 PM
amyk added a subscriber: amyk.Mon, Jul 5, 6:23 AM
amyk added inline comments.

Are the attributes needed?


Same question here (and the remaining tests).


Does it make sense to add pre-P9 for mulhd/mulhdu since they existed prior to P9?


Does it make sense to add pre-P9 for these instructions that existed prior to P9?

NeHuang updated this revision to Diff 356701.Tue, Jul 6, 6:34 AM
NeHuang marked 4 inline comments as done.

Address review comments on the test case. Target cpu sema checking covered in front end test cases. will keep current coverage in backend test.

gentle ping.

amyk added inline comments.Thu, Jul 8, 4:26 PM

This is just a question.
Is power9-vector the correct feature check in these cases? Does it matter if these are not vector instructions?


Does entry need to be removed from these tests (in case of failing in non-assert builds)?
Perhaps it may not fail but might be good to double check.


nit: unrelated change?

NeHuang updated this revision to Diff 357625.Fri, Jul 9, 1:51 PM
NeHuang marked 3 inline comments as done.

Address review comments on test case and remove change not needed.


yeah, we planned using this feature to do the sema check for pwr9 only (or later cpus) builtins.

Need to merge with changes once approved for pwr9 (or later processor) only sema checking.

NeHuang added inline comments.

Will merge in Power ISA features Sema checking patch for pwr9+ only sema checking once approved.

nemanjai added inline comments.Tue, Jul 13, 2:57 AM
9754 ↗(On Diff #357625)

No longer required after


Now that is approved, please change this to
isa-v30-instructions please.


Shouldn't operand 0 be marked as an immediate here?


Shouldn't $a be a u1imm?

nemanjai requested changes to this revision.Tue, Jul 13, 7:15 AM

Requesting changes to keep the queue accurate.

This revision now requires changes to proceed.Tue, Jul 13, 7:15 AM
NeHuang updated this revision to Diff 358397.Tue, Jul 13, 12:53 PM
NeHuang marked 4 inline comments as done.

Addressed review comments from Nemanja.

nemanjai accepted this revision.Tue, Jul 13, 2:19 PM

LGTM aside from a formatting nit.


Nit: This line looks too long. Some others below as well.

This revision is now accepted and ready to land.Tue, Jul 13, 2:19 PM
This revision was landed with ongoing or failed builds.Tue, Jul 13, 2:55 PM
This revision was automatically updated to reflect the committed changes.