Skip to content

Inline assembly doesn't work with FP constraint #20213

Closed
@alexchandel

Description

@alexchandel

The following code:

pub fn log(x: f64) -> f64
{
    let out: f64;
    unsafe {
    asm!("fldln2
        fldl $1
        fyl2x" : "=t"(out) : "m"(x));}
    out
}

errors with the message:

error: couldn't allocate output register for constraint 't' at line 27

The constraint t refers to the top of the floating point stack in GCC's inline assembly, and the unsafe guide says our constraints mirror theirs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions