llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.08k stars 11.99k forks source link

[inlineasm] earlyclobber modifier is silently ignored #1729

Closed isanbard closed 2 years ago

isanbard commented 17 years ago
Bugzilla Link 1357
Resolution FIXED
Resolved on Mar 06, 2010 13:59
Version trunk
OS All
Blocks llvm/llvm-project#1234
Attachments .ll Version of the Program, .c Version of the Program that Aborts

Extended Description

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! :-)

asl commented 2 years ago

mentioned in issue llvm/llvm-project#1234

isanbard commented 2 years ago

mentioned in issue llvm/llvm-bugzilla-archive#1374

lattner 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

lattner 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

isanbard commented 17 years ago

assigned to @lattner