From e6d64610672b1ee31bad39062417d7c113a42799 Mon Sep 17 00:00:00 2001 From: Justin Holewinski Date: Mon, 30 Mar 2015 19:30:55 +0000 Subject: [PATCH] [NVPTX] Associate a minimum PTX version for each SM architecture When a new SM architecture is introduced, it is only supported by the current PTX version and later. Make sure we are using at least the minimum PTX version for the target architecture. This also removes support for PTX ISA < 3.2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233583 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/NVPTX/NVPTX.td | 14 +++++--------- test/CodeGen/NVPTX/ptx-version-30.ll | 6 ------ test/CodeGen/NVPTX/ptx-version-31.ll | 6 ------ test/CodeGen/NVPTX/sm-version-30.ll | 1 + test/CodeGen/NVPTX/sm-version-32.ll | 1 + test/CodeGen/NVPTX/sm-version-35.ll | 1 + test/CodeGen/NVPTX/sm-version-37.ll | 1 + test/CodeGen/NVPTX/sm-version-50.ll | 7 +++++++ test/CodeGen/NVPTX/sm-version-52.ll | 1 + test/CodeGen/NVPTX/sm-version-53.ll | 1 + 10 files changed, 18 insertions(+), 21 deletions(-) delete mode 100644 test/CodeGen/NVPTX/ptx-version-30.ll delete mode 100644 test/CodeGen/NVPTX/ptx-version-31.ll create mode 100644 test/CodeGen/NVPTX/sm-version-50.ll diff --git a/lib/Target/NVPTX/NVPTX.td b/lib/Target/NVPTX/NVPTX.td index e27fd75c23f..96abfa85911 100644 --- a/lib/Target/NVPTX/NVPTX.td +++ b/lib/Target/NVPTX/NVPTX.td @@ -46,10 +46,6 @@ def SM53 : SubtargetFeature<"sm_53", "SmVersion", "53", "Target SM 5.3">; // PTX Versions -def PTX30 : SubtargetFeature<"ptx30", "PTXVersion", "30", - "Use PTX version 3.0">; -def PTX31 : SubtargetFeature<"ptx31", "PTXVersion", "31", - "Use PTX version 3.1">; def PTX32 : SubtargetFeature<"ptx32", "PTXVersion", "32", "Use PTX version 3.2">; def PTX40 : SubtargetFeature<"ptx40", "PTXVersion", "40", @@ -69,12 +65,12 @@ class Proc Features> def : Proc<"sm_20", [SM20]>; def : Proc<"sm_21", [SM21]>; def : Proc<"sm_30", [SM30]>; -def : Proc<"sm_32", [SM32]>; +def : Proc<"sm_32", [SM32, PTX40]>; def : Proc<"sm_35", [SM35]>; -def : Proc<"sm_37", [SM37]>; -def : Proc<"sm_50", [SM50]>; -def : Proc<"sm_52", [SM52]>; -def : Proc<"sm_53", [SM53]>; +def : Proc<"sm_37", [SM37, PTX41]>; +def : Proc<"sm_50", [SM50, PTX40]>; +def : Proc<"sm_52", [SM52, PTX41]>; +def : Proc<"sm_53", [SM53, PTX42]>; def NVPTXInstrInfo : InstrInfo { diff --git a/test/CodeGen/NVPTX/ptx-version-30.ll b/test/CodeGen/NVPTX/ptx-version-30.ll deleted file mode 100644 index 0422b01f4ee..00000000000 --- a/test/CodeGen/NVPTX/ptx-version-30.ll +++ /dev/null @@ -1,6 +0,0 @@ -; RUN: llc < %s -march=nvptx -mcpu=sm_20 -mattr=ptx30 | FileCheck %s -; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -mattr=ptx30 | FileCheck %s - - -; CHECK: .version 3.0 - diff --git a/test/CodeGen/NVPTX/ptx-version-31.ll b/test/CodeGen/NVPTX/ptx-version-31.ll deleted file mode 100644 index d6e57301a37..00000000000 --- a/test/CodeGen/NVPTX/ptx-version-31.ll +++ /dev/null @@ -1,6 +0,0 @@ -; RUN: llc < %s -march=nvptx -mcpu=sm_20 -mattr=ptx31 | FileCheck %s -; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -mattr=ptx31 | FileCheck %s - - -; CHECK: .version 3.1 - diff --git a/test/CodeGen/NVPTX/sm-version-30.ll b/test/CodeGen/NVPTX/sm-version-30.ll index 692b49a0d6b..4f35cf04c63 100644 --- a/test/CodeGen/NVPTX/sm-version-30.ll +++ b/test/CodeGen/NVPTX/sm-version-30.ll @@ -2,5 +2,6 @@ ; RUN: llc < %s -march=nvptx64 -mcpu=sm_30 | FileCheck %s +; CHECK: .version 3.2 ; CHECK: .target sm_30 diff --git a/test/CodeGen/NVPTX/sm-version-32.ll b/test/CodeGen/NVPTX/sm-version-32.ll index b737f36a774..d6a5082c526 100644 --- a/test/CodeGen/NVPTX/sm-version-32.ll +++ b/test/CodeGen/NVPTX/sm-version-32.ll @@ -2,5 +2,6 @@ ; RUN: llc < %s -march=nvptx64 -mcpu=sm_32 | FileCheck %s +; CHECK: .version 4.0 ; CHECK: .target sm_32 diff --git a/test/CodeGen/NVPTX/sm-version-35.ll b/test/CodeGen/NVPTX/sm-version-35.ll index 25368a01335..8456c666677 100644 --- a/test/CodeGen/NVPTX/sm-version-35.ll +++ b/test/CodeGen/NVPTX/sm-version-35.ll @@ -2,5 +2,6 @@ ; RUN: llc < %s -march=nvptx64 -mcpu=sm_35 | FileCheck %s +; CHECK: .version 3.2 ; CHECK: .target sm_35 diff --git a/test/CodeGen/NVPTX/sm-version-37.ll b/test/CodeGen/NVPTX/sm-version-37.ll index 957a3d95705..fd51a9c7063 100644 --- a/test/CodeGen/NVPTX/sm-version-37.ll +++ b/test/CodeGen/NVPTX/sm-version-37.ll @@ -2,5 +2,6 @@ ; RUN: llc < %s -march=nvptx64 -mcpu=sm_37 | FileCheck %s +; CHECK: .version 4.1 ; CHECK: .target sm_37 diff --git a/test/CodeGen/NVPTX/sm-version-50.ll b/test/CodeGen/NVPTX/sm-version-50.ll new file mode 100644 index 00000000000..374c6ea057a --- /dev/null +++ b/test/CodeGen/NVPTX/sm-version-50.ll @@ -0,0 +1,7 @@ +; RUN: llc < %s -march=nvptx -mcpu=sm_50 | FileCheck %s +; RUN: llc < %s -march=nvptx64 -mcpu=sm_50 | FileCheck %s + + +; CHECK: .version 4.0 +; CHECK: .target sm_50 + diff --git a/test/CodeGen/NVPTX/sm-version-52.ll b/test/CodeGen/NVPTX/sm-version-52.ll index 9b8fc72b5a9..18881b2e98c 100644 --- a/test/CodeGen/NVPTX/sm-version-52.ll +++ b/test/CodeGen/NVPTX/sm-version-52.ll @@ -2,5 +2,6 @@ ; RUN: llc < %s -march=nvptx64 -mcpu=sm_52 | FileCheck %s +; CHECK: .version 4.1 ; CHECK: .target sm_52 diff --git a/test/CodeGen/NVPTX/sm-version-53.ll b/test/CodeGen/NVPTX/sm-version-53.ll index f1b8e5bacf2..50d2dec11bc 100644 --- a/test/CodeGen/NVPTX/sm-version-53.ll +++ b/test/CodeGen/NVPTX/sm-version-53.ll @@ -2,5 +2,6 @@ ; RUN: llc < %s -march=nvptx64 -mcpu=sm_53 | FileCheck %s +; CHECK: .version 4.2 ; CHECK: .target sm_53