[PATCH] D23834: [AArch64] Allow label arithmetic with add/sub/cmp
Diana Picus via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 25 01:55:56 PDT 2016
rovka added a comment.
In https://reviews.llvm.org/D23834#524241, @peter.smith wrote:
> I agree with Renato that the ELF side looks good.
>
> Some suggestions the tests:
>
> - All of the instructions are either add or cmp and all use the w registers. It may be worth varying these a bit more to cover the other cases within the switch(Inst.getOpcode())
> - The labels used in the instructions look to be backwards references to labels already defined. It would be good to have some tests that use forward references to labels that are defined later in the file.
Those are very good suggestions, thanks.
> - All the Darwin tests are of the form (label1 - label2 + constant), are there other forms that can be expressed?
I'm actually not proud of the Darwin tests, but I wanted to get an initial round of feedback before diving too deep. From what I've played with so far, we can't express (label1 - label2) >> constant (at least not out of the box; I don't know how we'd add support for that). Also, since we're generating relocations, we can't diagnose a lot of cases where we error out for ELF - I'm not sure what to do about these, at the moment I'm just hoping the linker will error out in a helpful way, or maybe magically handle them by moving atoms around.
> I note that the label expression must evaluate to a positive value. For example #(end - start) is ok, but #(start - end) or #-(end-start) is not. I don't think that there is much that you can do about this in the general case as IIRC the value of the expression is evaluated after the fragments are fixed and it is too late to easily change an ADD into a SUB or vice-versa.
I should at least add a test-case diagnosing this though.
Thanks for the feedback.
https://reviews.llvm.org/D23834
More information about the llvm-commits
mailing list