Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[inlineasm] earlyclobber modifier is silently ignored #1364

Closed Quuxplusone closed 14 years ago

Quuxplusone commented 17 years ago
Bugzilla Link PR1357
Status RESOLVED FIXED
Importance P normal
Reported by Bill Wendling (isanbard@gmail.com)
Reported on 2007-04-25 04:26:15 -0700
Last modified on 2010-03-06 13:59:20 -0800
Version trunk
Hardware All All
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments testcase.ll (5421 bytes, text/plain)
testcase.c (2621 bytes, text/plain)
Blocks PR862
Blocked by
See also

I've attached the .ll file that aborts when run. It's something to do with the inline assembly thingy.

On the plus side, GMP compiled! :-)

Quuxplusone commented 17 years ago

Attached testcase.ll (5421 bytes, text/plain): .ll Version of the Program

Quuxplusone commented 17 years ago

Attached testcase.c (2621 bytes, text/plain): .c Version of the Program that Aborts

Quuxplusone commented 17 years ago
Reduced testcase:

long long test(int A, int B, int C) {
  unsigned X, Y;
  __asm__ ("subf%I3c %1,%4,%3\nsubfze %0,%2"
                 : "=r" (X), "=&r" (Y)
                 : "r" (A), "rI" (B), "r" (C));
  return ((long long)Y << 32) | X;
}

We compile this to:

_test:
        # InlineAsm Start
        subfc r3,r5,r4
        subfze r4,r3
        # InlineAsm End
        stw r3, -4(r1)
        blr

Note that the first instruction clobbers r3 before the second instruction uses
it.

-Chris
Quuxplusone commented 17 years ago
Fixed.  Patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070430/048747.html
There are several other required patches to go along with this though.

Testcase here: CodeGen/PowerPC/2007-04-30-InlineAsmEarlyClobber.ll

-Chris