[llvm] r211931 - [NVPTX] Add support for isspacep instruction
Justin Holewinski
jholewinski at nvidia.com
Fri Jun 27 11:35:25 PDT 2014
Author: jholewinski
Date: Fri Jun 27 13:35:24 2014
New Revision: 211931
URL: http://llvm.org/viewvc/llvm-project?rev=211931&view=rev
Log:
[NVPTX] Add support for isspacep instruction
Added:
llvm/trunk/test/CodeGen/NVPTX/isspacep.ll
Modified:
llvm/trunk/include/llvm/IR/IntrinsicsNVVM.td
llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.td
llvm/trunk/lib/Target/NVPTX/NVPTXIntrinsics.td
Modified: llvm/trunk/include/llvm/IR/IntrinsicsNVVM.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicsNVVM.td?rev=211931&r1=211930&r2=211931&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IntrinsicsNVVM.td (original)
+++ llvm/trunk/include/llvm/IR/IntrinsicsNVVM.td Fri Jun 27 13:35:24 2014
@@ -889,6 +889,24 @@ def int_nvvm_compiler_error :
def int_nvvm_compiler_warn :
Intrinsic<[], [llvm_anyptr_ty], [], "llvm.nvvm.compiler.warn">;
+// isspacep.{const, global, local, shared}
+def int_nvvm_isspacep_const
+ : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty], [IntrNoMem],
+ "llvm.nvvm.isspacep.const">,
+ GCCBuiltin<"__nvvm_isspacep_const">;
+def int_nvvm_isspacep_global
+ : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty], [IntrNoMem],
+ "llvm.nvvm.isspacep.global">,
+ GCCBuiltin<"__nvvm_isspacep_global">;
+def int_nvvm_isspacep_local
+ : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty], [IntrNoMem],
+ "llvm.nvvm.isspacep.local">,
+ GCCBuiltin<"__nvvm_isspacep_local">;
+def int_nvvm_isspacep_shared
+ : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty], [IntrNoMem],
+ "llvm.nvvm.isspacep.shared">,
+ GCCBuiltin<"__nvvm_isspacep_shared">;
+
// Environment register read
def int_nvvm_read_ptx_sreg_envreg0
: Intrinsic<[llvm_i32_ty], [], [IntrNoMem],
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.td?rev=211931&r1=211930&r2=211931&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.td (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXInstrInfo.td Fri Jun 27 13:35:24 2014
@@ -161,6 +161,8 @@ def hasHWROT32 : Predicate<"Subtarget.ha
def true : Predicate<"1">;
+def hasPTX31 : Predicate<"Subtarget.getPTXVersion() >= 31">;
+
//===----------------------------------------------------------------------===//
// Some Common Instruction Class Templates
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXIntrinsics.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXIntrinsics.td?rev=211931&r1=211930&r2=211931&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXIntrinsics.td (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXIntrinsics.td Fri Jun 27 13:35:24 2014
@@ -1689,6 +1689,44 @@ def INT_NVVM_COMPILER_ERROR_64 : NVPTXIn
[(int_nvvm_compiler_error Int64Regs:$a)]>;
+// isspacep
+
+def ISSPACEP_CONST_32
+ : NVPTXInst<(outs Int1Regs:$d), (ins Int32Regs:$a),
+ "isspacep.const \t$d, $a;",
+ [(set Int1Regs:$d, (int_nvvm_isspacep_const Int32Regs:$a))]>,
+ Requires<[hasPTX31]>;
+def ISSPACEP_CONST_64
+ : NVPTXInst<(outs Int1Regs:$d), (ins Int64Regs:$a),
+ "isspacep.const \t$d, $a;",
+ [(set Int1Regs:$d, (int_nvvm_isspacep_const Int64Regs:$a))]>,
+ Requires<[hasPTX31]>;
+def ISSPACEP_GLOBAL_32
+ : NVPTXInst<(outs Int1Regs:$d), (ins Int32Regs:$a),
+ "isspacep.global \t$d, $a;",
+ [(set Int1Regs:$d, (int_nvvm_isspacep_global Int32Regs:$a))]>;
+def ISSPACEP_GLOBAL_64
+ : NVPTXInst<(outs Int1Regs:$d), (ins Int64Regs:$a),
+ "isspacep.global \t$d, $a;",
+ [(set Int1Regs:$d, (int_nvvm_isspacep_global Int64Regs:$a))]>;
+def ISSPACEP_LOCAL_32
+ : NVPTXInst<(outs Int1Regs:$d), (ins Int32Regs:$a),
+ "isspacep.local \t$d, $a;",
+ [(set Int1Regs:$d, (int_nvvm_isspacep_local Int32Regs:$a))]>;
+def ISSPACEP_LOCAL_64
+ : NVPTXInst<(outs Int1Regs:$d), (ins Int64Regs:$a),
+ "isspacep.local \t$d, $a;",
+ [(set Int1Regs:$d, (int_nvvm_isspacep_local Int64Regs:$a))]>;
+def ISSPACEP_SHARED_32
+ : NVPTXInst<(outs Int1Regs:$d), (ins Int32Regs:$a),
+ "isspacep.shared \t$d, $a;",
+ [(set Int1Regs:$d, (int_nvvm_isspacep_shared Int32Regs:$a))]>;
+def ISSPACEP_SHARED_64
+ : NVPTXInst<(outs Int1Regs:$d), (ins Int64Regs:$a),
+ "isspacep.shared \t$d, $a;",
+ [(set Int1Regs:$d, (int_nvvm_isspacep_shared Int64Regs:$a))]>;
+
+
// Special register reads
def MOV_SPECIAL : NVPTXInst<(outs Int32Regs:$d),
(ins SpecialRegs:$r),
Added: llvm/trunk/test/CodeGen/NVPTX/isspacep.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/NVPTX/isspacep.ll?rev=211931&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/NVPTX/isspacep.ll (added)
+++ llvm/trunk/test/CodeGen/NVPTX/isspacep.ll Fri Jun 27 13:35:24 2014
@@ -0,0 +1,35 @@
+; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
+
+declare i1 @llvm.nvvm.isspacep.const(i8*) readnone noinline
+declare i1 @llvm.nvvm.isspacep.global(i8*) readnone noinline
+declare i1 @llvm.nvvm.isspacep.local(i8*) readnone noinline
+declare i1 @llvm.nvvm.isspacep.shared(i8*) readnone noinline
+
+; CHECK: is_const
+define i1 @is_const(i8* %addr) {
+; CHECK: isspacep.const
+ %v = tail call i1 @llvm.nvvm.isspacep.const(i8* %addr)
+ ret i1 %v
+}
+
+; CHECK: is_global
+define i1 @is_global(i8* %addr) {
+; CHECK: isspacep.global
+ %v = tail call i1 @llvm.nvvm.isspacep.global(i8* %addr)
+ ret i1 %v
+}
+
+; CHECK: is_local
+define i1 @is_local(i8* %addr) {
+; CHECK: isspacep.local
+ %v = tail call i1 @llvm.nvvm.isspacep.local(i8* %addr)
+ ret i1 %v
+}
+
+; CHECK: is_shared
+define i1 @is_shared(i8* %addr) {
+; CHECK: isspacep.shared
+ %v = tail call i1 @llvm.nvvm.isspacep.shared(i8* %addr)
+ ret i1 %v
+}
+
More information about the llvm-commits
mailing list