[PATCH] D31790: [PowerPC] Assume intrinsics with 128bit integer operands use CTR

Tim Neumann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 6 15:18:16 PDT 2017


TimNN created this revision.
Herald added a subscriber: nemanjai.

This is a (probably a bit heavy-handed) fix for https://bugs.llvm.org//show_bug.cgi?id=32485

Should this fix be indeed too heavy handed, I'm hoping for some guidance to create a better fix.

A somewhat minified example IR which reproduces the assertion is attached to the linked bug report -- here I would also appreciate some guidance on in what form / where this can be integrated in the regression tests.


https://reviews.llvm.org/D31790

Files:
  lib/Target/PowerPC/PPCCTRLoops.cpp


Index: lib/Target/PowerPC/PPCCTRLoops.cpp
===================================================================
--- lib/Target/PowerPC/PPCCTRLoops.cpp
+++ lib/Target/PowerPC/PPCCTRLoops.cpp
@@ -247,6 +247,13 @@
         // sin, cos, exp and log are always calls.
         unsigned Opcode = 0;
         if (F->getIntrinsicID() != Intrinsic::not_intrinsic) {
+          // Preemtively assume intrinsics operating on 128 integers use CTR
+          for (unsigned OID = 0; OID < CI->getNumArgOperands(); OID++) {
+            if (isLargeIntegerTy(false, CI->getArgOperand(OID)->getType()->getScalarType())) {
+              return true;
+            }
+          }
+
           switch (F->getIntrinsicID()) {
           default: continue;
           // If we have a call to ppc_is_decremented_ctr_nonzero, or ppc_mtctr


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31790.94445.patch
Type: text/x-patch
Size: 813 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170406/f3b9035e/attachment.bin>


More information about the llvm-commits mailing list