http://llvm.org/bugs/show_bug.cgi?id=7049

           Summary: ARM JIT for armv7 doesn't output several VFP
                    instructions correctly
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


I narrowed down to th fact that LLVM's ARM JIT will generate correct code if
the value of a float immed is greater than 32. Otherwise, LLVM's ARM JIT will
generate incorrect code.

A small test code is as follows. On ARM JIT, the result should be:
  x = 100.000000
  x = 114.000000
But on my armv7 device, it outputs:
  x = 100.000000
  x = 102.000000

---------- Beginning test code ----------
#define PULSE_SIZE 14
#define TRAIL_SIZE 40

struct pulse_s {
   float originX;
   float originY;
};

int main() {
   struct pulse_s pulseSet[1];
   int i = 0;
   float x;
   for (i = 0; i < 1; i++) {
       pulseSet[i].originX = (float) 100;
       pulseSet[i].originY = (float) i;
   }

   x = pulseSet[0].originX;
   printf("x = %f\n", x);
   x += PULSE_SIZE;
   printf("x = %f\n", x);
   return 0;
}
---------- End of Code --------------

If PULSE_SIZE < 32.0f, LLVM JIT generates:
  vmov.f32 s0, #0
  vadd.f32 s0, s16, s0  (s16 is x),
  which is incorrect.

Otherwise, it will generate:
  vldr.32 s0, [pc, #32]
  vadd.f32 s0, s16, s0,
  which is correct.

This is because the Instruction Selection in LLVM is doing the right thing that
vmov can take immed values that's less than 32. But the code emission is not
implemented. This code is worse than the bug in
http://llvm.org/bugs/show_bug.cgi?id=7048. At least in Bug #7048, the
unimplemented paths are guarded by assertion failures. For this bug, the
emitMiscInstruction() just didn't check. As a result, it took a while for
narrowing down/fixing.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to