Skip to content

Invalid operand found in inline asm: 'movl %gs:${1:P},$0' #3751

@edwintorok

Description

@edwintorok
Bugzilla Link 3379
Resolution FIXED
Resolved on Apr 28, 2009 16:52
Version unspecified
OS Linux
Blocks llvm/llvm-bugzilla-archive#4064
CC @asl

Extended Description

Another one from the kernel

typedef unsigned long long u64;
extern typeof(int) per_cpu__cpu_number;
static u64 attribute((section(".data.read_mostly"))) boot_pat_state;
void pat_init(void) {
u64 pat;
printk("<6>" "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n", (({
typeof(per_cpu__cpu_number) ret__;
switch (sizeof(per_cpu__cpu_number)) {
case 4: asm("mov" "l ""%%""gs"":%P" "1"",%0" : "=r" (ret__) : "m" (per_cpu__cpu_number));
}
ret__;
}
)), boot_pat_state, pat);
}

$ llvm-gcc testcase-min.i
Invalid operand found in inline asm: 'movl %gs:${1:P},$0'
INLINEASM <es:movl %gs:${1:P},$0>, 10, %ECX, 36, %reg0, 1, %reg0, ga:per_cpu__cpu_number

With %1 gcc generates this:
movl %gs:per_cpu__cpu_number,%eax

Without %P gcc generates this:
movl %gs:per_cpu__cpu_number(%rip),%eax

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions