Skip to content

Error when using label difference as immediate for MOV on aarch64 #153

@N00byEdge

Description

@N00byEdge

To reproduce:
clang -c test.S -target aarch64
test.S:

.section .text
_start:
    MOV X0, L2 - L1 // test.S:3:13: error: expected compatible register or logical immediate
    MOV X1, #0 // Works just fine

L1:
L2:

The amount of data between the labels doesn't seem to matter. Just inserting the calculated values in here works fine.

The code compiles with gas and the difference between the labels is used as the immediate value, the expected behavior.

Is there a different syntax for using this as an immediate value, or is it just not implemented yet? I've tried sticking a breakpoint on ::encodeLogicalImmediate() but it looks like it's not being hit, so I suspect that it would probably be the latter.

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