[PATCH] D127668: [NVPTX] Fix pointer type for short 32-bit pointers
Andrew Savonichev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 15 10:52:50 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc38fa7c01403: [NVPTX] Fix pointer type for short 32-bit pointers (authored by asavonic).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127668/new/
https://reviews.llvm.org/D127668
Files:
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/test/CodeGen/NVPTX/short-ptr.ll
Index: llvm/test/CodeGen/NVPTX/short-ptr.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/NVPTX/short-ptr.ll
@@ -0,0 +1,17 @@
+; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s --check-prefix CHECK-DEFAULT
+; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s --check-prefix CHECK-DEFAULT-32
+; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -nvptx-short-ptr | FileCheck %s --check-prefixes CHECK-SHORT-SHARED,CHECK-SHORT-CONST
+
+; RUN: %if ptxas %{ llc < %s -march=nvptx -mcpu=sm_20 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_20 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_20 -nvptx-short-ptr | %ptxas-verify %}
+
+; CHECK-DEFAULT: .visible .shared .align 8 .u64 s
+; CHECK-DEFAULT-32: .visible .shared .align 8 .u32 s
+; CHECK-SHORT-SHARED: .visible .shared .align 8 .u32 s
+ at s = local_unnamed_addr addrspace(3) global i32 addrspace(3)* null, align 8
+
+; CHECK-DEFAULT: .visible .const .align 8 .u64 c
+; CHECK-DEFAULT-32: .visible .const .align 8 .u32 c
+; CHECK-SHORT-CONST: .visible .const .align 8 .u32 c
+ at c = local_unnamed_addr addrspace(4) global i32 addrspace(4)* null, align 8
Index: llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1365,8 +1365,11 @@
return "f32";
case Type::DoubleTyID:
return "f64";
- case Type::PointerTyID:
- if (static_cast<const NVPTXTargetMachine &>(TM).is64Bit())
+ case Type::PointerTyID: {
+ unsigned PtrSize = TM.getPointerSizeInBits(Ty->getPointerAddressSpace());
+ assert((PtrSize == 64 || PtrSize == 32) && "Unexpected pointer size");
+
+ if (PtrSize == 64)
if (useB4PTR)
return "b64";
else
@@ -1375,6 +1378,7 @@
return "b32";
else
return "u32";
+ }
default:
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127668.475523.patch
Type: text/x-patch
Size: 1973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221115/fcbbaef2/attachment.bin>
More information about the llvm-commits
mailing list