From af7b5d7092a897baa05e18736e106d2890a54d11 Mon Sep 17 00:00:00 2001 From: Konstantin Zhuravlyov Date: Thu, 15 Nov 2018 23:14:23 +0000 Subject: [PATCH] AMDHSA: More code object v3 fixes: - Make sure IsaInfo::hasCodeObjectV3 returns true only for AMDHSA - Update assembler metadata tests to use v2 by default llvm-svn: 347001 --- llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp | 3 ++- llvm/test/MC/AMDGPU/hsa-diag-v3.s | 2 +- llvm/test/MC/AMDGPU/hsa-metadata-kernel-args.s | 6 +++--- llvm/test/MC/AMDGPU/hsa-metadata-kernel-attrs.s | 6 +++--- llvm/test/MC/AMDGPU/hsa-metadata-kernel-code-props.s | 6 +++--- llvm/test/MC/AMDGPU/hsa-metadata-kernel-debug-props.s | 6 +++--- llvm/test/MC/AMDGPU/hsa-metadata-unknown-key.s | 12 ++++++------ 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp index 634ec8f..fc1e712 100644 --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp @@ -159,7 +159,8 @@ void streamIsaVersion(const MCSubtargetInfo *STI, raw_ostream &Stream) { } bool hasCodeObjectV3(const MCSubtargetInfo *STI) { - return STI->getFeatureBits().test(FeatureCodeObjectV3); + return STI->getTargetTriple().getOS() == Triple::AMDHSA && + STI->getFeatureBits().test(FeatureCodeObjectV3); } unsigned getWavefrontSize(const MCSubtargetInfo *STI) { diff --git a/llvm/test/MC/AMDGPU/hsa-diag-v3.s b/llvm/test/MC/AMDGPU/hsa-diag-v3.s index b05b8d1..5f2d89d 100644 --- a/llvm/test/MC/AMDGPU/hsa-diag-v3.s +++ b/llvm/test/MC/AMDGPU/hsa-diag-v3.s @@ -21,7 +21,7 @@ .end_amdhsa_kernel .amdhsa_kernel foo - // NOT-AMDHSA: error: directive only supported for amdhsa OS + // NOT-AMDHSA: error: unknown directive .end_amdhsa_kernel .amdhsa_kernel foo diff --git a/llvm/test/MC/AMDGPU/hsa-metadata-kernel-args.s b/llvm/test/MC/AMDGPU/hsa-metadata-kernel-args.s index 2f9960f..f0c2908 100644 --- a/llvm/test/MC/AMDGPU/hsa-metadata-kernel-args.s +++ b/llvm/test/MC/AMDGPU/hsa-metadata-kernel-args.s @@ -1,6 +1,6 @@ -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s // CHECK: .amd_amdgpu_hsa_metadata // CHECK: Version: [ 1, 0 ] diff --git a/llvm/test/MC/AMDGPU/hsa-metadata-kernel-attrs.s b/llvm/test/MC/AMDGPU/hsa-metadata-kernel-attrs.s index 5a9fdd2..e19bf44 100644 --- a/llvm/test/MC/AMDGPU/hsa-metadata-kernel-attrs.s +++ b/llvm/test/MC/AMDGPU/hsa-metadata-kernel-attrs.s @@ -1,6 +1,6 @@ -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s // CHECK: .amd_amdgpu_hsa_metadata // CHECK: Version: [ 1, 0 ] diff --git a/llvm/test/MC/AMDGPU/hsa-metadata-kernel-code-props.s b/llvm/test/MC/AMDGPU/hsa-metadata-kernel-code-props.s index 0b04042..c8cc3cf 100644 --- a/llvm/test/MC/AMDGPU/hsa-metadata-kernel-code-props.s +++ b/llvm/test/MC/AMDGPU/hsa-metadata-kernel-code-props.s @@ -1,6 +1,6 @@ -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s // CHECK: .amd_amdgpu_hsa_metadata // CHECK: Version: [ 1, 0 ] diff --git a/llvm/test/MC/AMDGPU/hsa-metadata-kernel-debug-props.s b/llvm/test/MC/AMDGPU/hsa-metadata-kernel-debug-props.s index 7efb820..e3bd87f 100644 --- a/llvm/test/MC/AMDGPU/hsa-metadata-kernel-debug-props.s +++ b/llvm/test/MC/AMDGPU/hsa-metadata-kernel-debug-props.s @@ -1,6 +1,6 @@ -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s -// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s +// RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=-code-object-v3 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s // CHECK: .amd_amdgpu_hsa_metadata // CHECK: Version: [ 1, 0 ] diff --git a/llvm/test/MC/AMDGPU/hsa-metadata-unknown-key.s b/llvm/test/MC/AMDGPU/hsa-metadata-unknown-key.s index f532930..2fbbde7 100644 --- a/llvm/test/MC/AMDGPU/hsa-metadata-unknown-key.s +++ b/llvm/test/MC/AMDGPU/hsa-metadata-unknown-key.s @@ -1,9 +1,9 @@ -// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 %s 2>&1 | FileCheck %s -// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 %s 2>&1 | FileCheck %s -// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 %s 2>&1 | FileCheck %s -// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -filetype=obj %s 2>&1 | FileCheck %s -// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -filetype=obj %s 2>&1 | FileCheck %s -// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj %s 2>&1 | FileCheck %s +// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -mattr=-code-object-v3 %s 2>&1 | FileCheck %s +// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -mattr=-code-object-v3 %s 2>&1 | FileCheck %s +// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=-code-object-v3 %s 2>&1 | FileCheck %s +// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -mattr=-code-object-v3 -filetype=obj %s 2>&1 | FileCheck %s +// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -mattr=-code-object-v3 -filetype=obj %s 2>&1 | FileCheck %s +// RUN: not llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=-code-object-v3 -filetype=obj %s 2>&1 | FileCheck %s // CHECK: error: unknown key 'UnknownKey' .amd_amdgpu_hsa_metadata -- 2.7.4