[llvm] 4a2807d - [AArch64] Convert test to opaque pointers (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 03:32:27 PST 2022
Author: Nikita Popov
Date: 2022-12-20T12:32:19+01:00
New Revision: 4a2807d24849d9811d7f6b265a40e5ba572771cc
URL: https://github.com/llvm/llvm-project/commit/4a2807d24849d9811d7f6b265a40e5ba572771cc
DIFF: https://github.com/llvm/llvm-project/commit/4a2807d24849d9811d7f6b265a40e5ba572771cc.diff
LOG: [AArch64] Convert test to opaque pointers (NFC)
One test case was testing the case where a bitcasted function
pointer is passed to an X constraint. With opaque pointers, this
is no longer a thing, and it gets treated the same way as a
non-bitcasted function pointer. Per the comment, this is a
desirable change.
Added:
Modified:
llvm/test/CodeGen/AArch64/inlineasm-X-constraint.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/AArch64/inlineasm-X-constraint.ll b/llvm/test/CodeGen/AArch64/inlineasm-X-constraint.ll
index c01f4a646fdc..f06078402a8f 100644
--- a/llvm/test/CodeGen/AArch64/inlineasm-X-constraint.ll
+++ b/llvm/test/CodeGen/AArch64/inlineasm-X-constraint.ll
@@ -18,9 +18,9 @@
define double @f1(double %f, i32 %pscr_value) {
entry:
%f.addr = alloca double, align 8
- store double %f, double* %f.addr, align 8
- call void asm sideeffect "msr fpsr,$1", "=*X,r"(double* elementtype(double) nonnull %f.addr, i32 %pscr_value) nounwind
- %0 = load double, double* %f.addr, align 8
+ store double %f, ptr %f.addr, align 8
+ call void asm sideeffect "msr fpsr,$1", "=*X,r"(ptr elementtype(double) nonnull %f.addr, i32 %pscr_value) nounwind
+ %0 = load double, ptr %f.addr, align 8
%add = fadd double %0, %0
ret double %add
}
@@ -36,9 +36,9 @@ entry:
define i32 @f2(i32 %f, i32 %pscr_value) {
entry:
%f.addr = alloca i32, align 4
- store i32 %f, i32* %f.addr, align 4
- call void asm sideeffect "msr fpsr,$1", "=*X,r"(i32* elementtype(i32) nonnull %f.addr, i32 %pscr_value) nounwind
- %0 = load i32, i32* %f.addr, align 4
+ store i32 %f, ptr %f.addr, align 4
+ call void asm sideeffect "msr fpsr,$1", "=*X,r"(ptr elementtype(i32) nonnull %f.addr, i32 %pscr_value) nounwind
+ %0 = load i32, ptr %f.addr, align 4
%mul = mul i32 %0, %0
ret i32 %mul
}
@@ -59,10 +59,9 @@ entry:
define <8 x i8> @f3() {
entry:
%vector_res_int8x8 = alloca <8 x i8>, align 8
- %0 = getelementptr inbounds <8 x i8>, <8 x i8>* %vector_res_int8x8, i32 0, i32 0
- call void asm sideeffect "msr fpsr,$1", "=*X,r"(<8 x i8>* elementtype(<8 x i8>) nonnull %vector_res_int8x8, i32 undef) nounwind
- %1 = load <8 x i8>, <8 x i8>* %vector_res_int8x8, align 8
- %mul = mul <8 x i8> %1, %1
+ call void asm sideeffect "msr fpsr,$1", "=*X,r"(ptr elementtype(<8 x i8>) nonnull %vector_res_int8x8, i32 undef) nounwind
+ %0 = load <8 x i8>, ptr %vector_res_int8x8, align 8
+ %mul = mul <8 x i8> %0, %0
ret <8 x i8> %mul
}
@@ -90,31 +89,24 @@ entry:
; CHECK: bl f4
define void @f5() {
entry:
- tail call void asm sideeffect "bl $0", "X"(void ()* nonnull @f4)
+ tail call void asm sideeffect "bl $0", "X"(ptr nonnull @f4)
ret void
}
declare void @foo(...)
; This tests the behavior of the X constraint when used on functions pointers,
-; or functions with a cast. In the first asm call we figure out that this
-; is a function pointer and emit the label. However, in the second asm call
-; we can't see through the bitcast and we end up having to lower this constraint
-; to something else. This is not ideal, but it is a correct behaviour according
-; to the definition of the X constraint.
-;
-; In this case (and other cases where we could have emitted something else),
-; what we're doing with the X constraint is not particularly useful either,
-; since the user could have used "r" in this situation for the same effect.
+; or functions with a cast. We figure out that this is a function pointer and
+; emit the label.
; CHECK-LABEL: f6
; CHECK: bl foo
-; CHECK: br x
+; CHECK: bl f4
define void @f6() nounwind {
entry:
- tail call void asm sideeffect "bl $0", "X"(void (...)* @foo) nounwind
- tail call void asm sideeffect "br $0", "X"(void (...)* bitcast (void ()* @f4 to void (...)*)) nounwind
+ tail call void asm sideeffect "bl $0", "X"(ptr @foo) nounwind
+ tail call void asm sideeffect "bl $0", "X"(ptr @f4) nounwind
ret void
}
@@ -129,7 +121,7 @@ entry:
; CHECK-LABEL: f7
; CHECK: bl .Ltmp3
define void @f7() {
- call void asm sideeffect "bl $0", "X"( i8* blockaddress(@f7, %bb) )
+ call void asm sideeffect "bl $0", "X"( ptr blockaddress(@f7, %bb) )
br label %bb
bb:
ret void
@@ -139,8 +131,8 @@ bb:
; CHECK-LABEL: f8
; CHECK: add [[Dest:x[0-9]+]], x0, x0
; CHECK: str [[Dest]], [x0]
-define void @f8(i64 *%x) {
+define void @f8(ptr %x) {
entry:
- tail call void asm sideeffect "add $0, x0, x0", "=*X"(i64* elementtype(i64) %x)
+ tail call void asm sideeffect "add $0, x0, x0", "=*X"(ptr elementtype(i64) %x)
ret void
}
More information about the llvm-commits
mailing list