[llvm-bugs] [Bug 28630] New: Wrong code generation for VSX floating-point loads with fast-isel

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 20 10:36:50 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28630

            Bug ID: 28630
           Summary: Wrong code generation for VSX floating-point loads
                    with fast-isel
           Product: libraries
           Version: trunk
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: uweigand at de.ibm.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

In some cases, fast-isel generates floating-point load instructions (lfd) with
an invalid register, like:
   lfd 36, ...
instead of using a VSX load instruction.  The wrong register number gets
silently truncated, causing invalid code to be generated.

Two source code examples showing this problem (clang at -O0):

1.) Loading a floating-point constant:

extern void checkd (double x, double v);

void
testd (double x01, double x02, double x03, double x04, double x05, double x06,
       double x07, double x08, double x09, double x10, double x11, double x12,
       double x13, double x14, double x15, double x16)
{
  checkd (x01, 1);
}

2.) Loading a floating-point global variable:

double g01d, g02d, g03d, g04d;
double g05d, g06d, g07d, g08d;
double g09d, g10d, g11d, g12d;
double g13d, g14d, g15d, g16d;

extern void testd (double x01, double x02, double x03, double x04, double x05,
                   double x06, double x07, double x08, double x09, double x10,
                   double x11, double x12, double x13, double x14, double x15,
                   double x16);

void
testitd (void)
{
  testd (g01d, g02d, g03d, g04d, g05d, g06d, g07d, g08d, g09d, g10d, g11d,
         g12d, g13d, g14d, g15d, g16d);
}


The issue can be detected more easily by enabling the -verify-machineinstrs llc
flag, which will detect the incorrect register class for the LFD result. 
Simplied IR test cases are:

1.) Loading a floating-point constant:

define double @test() {
  ret double 1.000000e+00
}

2.) Loading a floating-point global variable:

@g = common global double 0.000000e+00, align 8

define double @testitd() {
  %g = load double, double* @g, align 8
  ret double %g
}


I'm working on a couple of patches currently under test.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160720/a929b1e8/attachment.html>


More information about the llvm-bugs mailing list