Skip to content

constraints for @asmcall with one output and multiple outputs #531

@epilliat

Description

@epilliat

@asmcall with multiple outputs and inputs fails with LLVM assembly parsing error

The test suite includes a working example of @asmcall with multiple outputs and zero inputs:

e1() = @asmcall("mov \$\$1, \$0; mov \$\$2, \$1;", "=r,=r", Tuple{Int16,Int32})
@test e1() == (Int16(1), Int32(2))

However, when attempting to use @asmcall with multiple outputs and one or more inputs, LLVM fails to parse the generated assembly:

e1(x::Int32) = @asmcall(
    "mov.s32 \$0, \$2; add.s32 \$1, \$2, 10;",
    "=r,=r,r",              # Two outputs, one input
    true,
    Tuple{Int32,Int32},     # Return tuple
    Tuple{Int32},           # One input type
    x
)

e1(Int32(12))

Error:

Failed to parse LLVM assembly: 
<string>:7:23: error: number of output constraints does not match number of return struct elements
  %1 = call [2 x i32] asm sideeffect "mov.s32 $0, $2; add.s32 $1, $2, 10;", "=r,=r,r"(i32 %0)

Expected behavior: @asmcall should handle multiple outputs with inputs, just as it does with multiple outputs and zero inputs.

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