Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[inlineasm] x86 backend references incorrect size registers for single-register classes #1222

Closed
llvmbot opened this issue Jul 28, 2006 · 5 comments
Assignees
Labels
backend:X86 bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead miscompilation

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 28, 2006

Bugzilla Link 850
Resolution FIXED
Resolved on Feb 22, 2010 12:49
Version 1.7
OS Linux
Reporter LLVM Bugzilla Contributor

Extended Description

This llvm asm:
%tmp9.i.i = call int asm sideeffect "push %ebp\0Apush %ebx\0Amovl
4($2),%ebp\0Amovl 0($2), %ebx\0Amovl $1,%eax\0Aint $$0x80\0Apop %ebx\0Apop
%ebp", "={ax},i,0,{cx},{dx},{si},{di},{dirflag},{fpsr},{flags},{memory}"(
int 192, int %__s.i.i, int %tmp5.i.i, int %tmp6.i.i, int %tmp7.i.i, int %tmp8.i.i )

is being translated to this x86 asm:
push %ebp
push %ebx
movl 4(%ax),%ebp
movl 0(%ax), %ebx
movl $192,%eax
int $0x80
pop %ebx
pop %ebp

which gives this error:
/tmp/tmpQspyNp.s: Assembler messages:
/tmp/tmpQspyNp.s:277646: Error: 4(%ax)' is not a valid base/index expression /tmp/tmpQspyNp.s:277647: Error: 0(%ax)' is not a valid base/index expression

I don't speak asm, so I don't know if this error is in the gcc inline asm ->
llvm inline asm or the llvm asm -> x86 translation process.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 28, 2006

assigned to @lattner

@lattner
Copy link
Collaborator

lattner commented Jul 28, 2006

can you please include a (small but compilable) chunk of C code for this?

Thanks,

-Chris

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 29, 2006

static inline void* foo(void* arg1, unsigned int arg2, int arg3, int arg4,
int arg5, unsigned long long arg6) {
long __res;
struct { long __a1; long __a6; } __s = { (long)arg1, (long) arg6 };
asm volatile("push %%ebp\n"
"push %%ebx\n"
"movl 4(%2),%%ebp\n"
"movl 0(%2), %%ebx\n"
"movl %1,%%eax\n"
"int $0x80\n"
"pop %%ebx\n"
"pop %%ebp"
: "=a" (__res)
: "i" (192), "0" ((long)(&__s)),
"c" ((long)(arg2)), "d" ((long)(arg3)),
"S" ((long)(arg4)), "D" ((long)(arg5))
: "memory");

return (void*)__res;
}
int main() {
foo(0,0,0,0,0,0);
}

@lattner
Copy link
Collaborator

lattner commented Jul 29, 2006

Thanks, this looks like a front-end problem. I will start investigating this on monday.

@lattner
Copy link
Collaborator

lattner commented Aug 1, 2006

Fixed. Testcase here: CodeGen/X86/2006-07-31-SingleRegClass.ll

Patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20060731/036363.html

-Chris

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead miscompilation
Projects
None yet
Development

No branches or pull requests

2 participants