Skip to content

[AArch64] update "rm" inline asm test #67472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

nickdesaulniers
Copy link
Member

Because x0 is not listed in the clobber list, regalloc could (one day
when #20571 is fixed) allocate $0 to x0:

ldr x0, x0

This will produce an error when validating the instruction. The intent
of this test FWICT is to check that the parameter in w0 is stored to a
stack slot using w0, since this target triple is the exotic arm64_32
(ILP32). Update the test to simply use "m" constraint. The clobber list
is underconstrained otherwise.

Because `x0` is not listed in the clobber list, regalloc could (one day
when llvm#20571 is fixed) allocate `$0` to `x0`:

  ldr x0, x0

This will produce an error when validating the instruction. The intent
of this test FWICT is to check that the parameter in w0 is stored to a
stack slot using w0, since this target triple is the exotic arm64_32
(ILP32). Update the test to simply use "m" constraint. The clobber list
is underconstrained otherwise.
@llvmbot
Copy link
Member

llvmbot commented Sep 26, 2023

@llvm/pr-subscribers-backend-aarch64

Changes

Because x0 is not listed in the clobber list, regalloc could (one day
when #20571 is fixed) allocate $0 to x0:

ldr x0, x0

This will produce an error when validating the instruction. The intent
of this test FWICT is to check that the parameter in w0 is stored to a
stack slot using w0, since this target triple is the exotic arm64_32
(ILP32). Update the test to simply use "m" constraint. The clobber list
is underconstrained otherwise.


Full diff: https://github.com/llvm/llvm-project/pull/67472.diff

1 Files Affected:

  • (modified) llvm/test/CodeGen/AArch64/arm64_32.ll (+1-1)
diff --git a/llvm/test/CodeGen/AArch64/arm64_32.ll b/llvm/test/CodeGen/AArch64/arm64_32.ll
index d3b30d398ffcc3c..16e2e84a14329d1 100644
--- a/llvm/test/CodeGen/AArch64/arm64_32.ll
+++ b/llvm/test/CodeGen/AArch64/arm64_32.ll
@@ -649,7 +649,7 @@ define <2 x ptr> @test_pointer_vec_load(ptr %addr) {
 define void @test_inline_asm_mem_pointer(ptr %in) {
 ; CHECK-LABEL: test_inline_asm_mem_pointer:
 ; CHECK: str w0,
-  tail call void asm sideeffect "ldr x0, $0", "rm"(ptr %in)
+  tail call void asm sideeffect "ldr x0, $0", "m"(ptr %in)
   ret void
 }
 

Copy link
Contributor

@MatzeB MatzeB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is that it need to be ldr x0, [x0] to be valid? Either way removing that constraint makes sense as the CHECK line clearly tests for the store necessary for a memory operand. LGTM

@nickdesaulniers
Copy link
Member Author

The problem here is that it need to be ldr x0, [x0] to be valid?

Yes.

These are the relevant sections of the Arm ARM:
C6.2.166 LDR (immediate)
C6.2.167 LDR (literal)
C6.2.168 LDR (register)

In the immediate and register addressing modes, the second operand must be a memory location. (register example):

LDR <Xt>, [<Xn|SP>, (<Wm>|<Xm>){, <extend> {<amount>}}]

(immediate has pre and post incrementing modes, and another with an unsigned offset)

There are no addressing modes where the second operand can be a register.

@nickdesaulniers nickdesaulniers merged commit 97187e1 into llvm:main Sep 27, 2023
@nickdesaulniers nickdesaulniers deleted the arm64_test branch September 27, 2023 15:30
legrosbuffle pushed a commit to legrosbuffle/llvm-project that referenced this pull request Sep 29, 2023
Because `x0` is not listed in the clobber list, regalloc could (one day
when llvm#20571 is fixed) allocate `$0` to `x0`:

  ldr x0, x0

This will produce an error when validating the instruction. The intent
of this test FWICT is to check that the parameter in w0 is stored to a
stack slot using w0, since this target triple is the exotic arm64_32
(ILP32). Update the test to simply use "m" constraint. The clobber list
is underconstrained otherwise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants