PTX: Add .address_size directive if PTX version >= 2.3

Patch by Wei-Ren Chen

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133589 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Holewinski 2011-06-22 00:43:56 +00:00
parent f11bb7f80d
commit a9c85f9ead
2 changed files with 9 additions and 0 deletions

View File

@ -163,6 +163,13 @@ void PTXAsmPrinter::EmitStartOfAsmFile(Module &M)
OutStreamer.EmitRawText(Twine("\t.target " + ST.getTargetString() +
(ST.supportsDouble() ? ""
: ", map_f64_to_f32")));
// .address_size directive is optional, but it must immediately follow
// the .target directive if present within a module
if (ST.supportsPTX23()) {
std::string addrSize = ST.is64Bit() ? "64" : "32";
OutStreamer.EmitRawText(Twine("\t.address_size " + addrSize));
}
OutStreamer.AddBlankLine();
// declare global variables

View File

@ -5,6 +5,8 @@
; RUN: llc < %s -march=ptx32 -mattr=sm10 | grep ".target sm_10"
; RUN: llc < %s -march=ptx32 -mattr=sm13 | grep ".target sm_13"
; RUN: llc < %s -march=ptx32 -mattr=sm20 | grep ".target sm_20"
; RUN: llc < %s -march=ptx32 -mattr=ptx23 | grep ".address_size 32"
; RUN: llc < %s -march=ptx64 -mattr=ptx23 | grep ".address_size 64"
define ptx_device void @t1() {
ret void