From 306b1a0119e6e92dcf37f51c77416129110a7c43 Mon Sep 17 00:00:00 2001 From: Dmitry Preobrazhensky Date: Fri, 6 Apr 2018 17:25:00 +0000 Subject: [PATCH] [AMDGPU][MC][GFX9] Added instruction s_endpgm_ordered_ps_done See bug 36844: https://bugs.llvm.org/show_bug.cgi?id=36844 Differential Revision: https://reviews.llvm.org/D45313 Reviewers: artem.tamazov, arsenm, timcorringham llvm-svn: 329430 --- llvm/lib/Target/AMDGPU/SOPInstructions.td | 7 +++++++ llvm/test/MC/AMDGPU/sopk.s | 14 +++++++++++--- llvm/test/MC/Disassembler/AMDGPU/sopk_gfx9.txt | 4 ++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 llvm/test/MC/Disassembler/AMDGPU/sopk_gfx9.txt diff --git a/llvm/lib/Target/AMDGPU/SOPInstructions.td b/llvm/lib/Target/AMDGPU/SOPInstructions.td index 375c2d666383..3b5c3d0d552b 100644 --- a/llvm/lib/Target/AMDGPU/SOPInstructions.td +++ b/llvm/lib/Target/AMDGPU/SOPInstructions.td @@ -819,6 +819,13 @@ def S_ENDPGM_SAVED : SOPP <0x0000001B, (ins), "s_endpgm_saved"> { } } +let SubtargetPredicate = isGFX9 in { + let isBarrier = 1, isReturn = 1, simm16 = 0 in { + def S_ENDPGM_ORDERED_PS_DONE : + SOPP<0x01e, (ins), "s_endpgm_ordered_ps_done">; + } // End isBarrier = 1, isReturn = 1, simm16 = 0 +} // End SubtargetPredicate = isGFX9 + let isBranch = 1, SchedRW = [WriteBranch] in { def S_BRANCH : SOPP < 0x00000002, (ins sopp_brtarget:$simm16), "s_branch $simm16", diff --git a/llvm/test/MC/AMDGPU/sopk.s b/llvm/test/MC/AMDGPU/sopk.s index 1f7aeb9fc0b6..35e6c579563f 100644 --- a/llvm/test/MC/AMDGPU/sopk.s +++ b/llvm/test/MC/AMDGPU/sopk.s @@ -1,8 +1,12 @@ -// RUN: llvm-mc -arch=amdgcn -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=SICI %s -// RUN: llvm-mc -arch=amdgcn -mcpu=tahiti -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=SICI %s -// RUN: llvm-mc -arch=amdgcn -mcpu=fiji -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=VI9 --check-prefix=VI %s +// RUN: not llvm-mc -arch=amdgcn -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=SICI %s +// RUN: not llvm-mc -arch=amdgcn -mcpu=tahiti -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=SICI %s +// RUN: not llvm-mc -arch=amdgcn -mcpu=fiji -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=VI9 --check-prefix=VI %s // RUN: llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=VI9 --check-prefix=GFX9 %s +// RUN: not llvm-mc -arch=amdgcn %s 2>&1 | FileCheck -check-prefix=NOSICIVI %s +// RUN: not llvm-mc -arch=amdgcn -mcpu=tahiti %s 2>&1 | FileCheck -check-prefix=NOSICIVI -check-prefix=NOSI %s +// RUN: not llvm-mc -arch=amdgcn -mcpu=fiji %s 2>&1 | FileCheck -check-prefix=NOSICIVI -check-prefix=NOVI %s + //===----------------------------------------------------------------------===// // Instructions //===----------------------------------------------------------------------===// @@ -167,3 +171,7 @@ s_setreg_imm32_b32 0x6, 0xff s_setreg_imm32_b32 hwreg(HW_REG_GPR_ALLOC, 1, 31), 0xff // SICI: s_setreg_imm32_b32 hwreg(HW_REG_GPR_ALLOC, 1, 31), 0xff ; encoding: [0x45,0xf0,0x80,0xba,0xff,0x00,0x00,0x00] // VI9: s_setreg_imm32_b32 hwreg(HW_REG_GPR_ALLOC, 1, 31), 0xff ; encoding: [0x45,0xf0,0x00,0xba,0xff,0x00,0x00,0x00] + +s_endpgm_ordered_ps_done +// GFX9: s_endpgm_ordered_ps_done ; encoding: [0x00,0x00,0x9e,0xbf] +// NOSICIVI: error: instruction not supported on this GPU diff --git a/llvm/test/MC/Disassembler/AMDGPU/sopk_gfx9.txt b/llvm/test/MC/Disassembler/AMDGPU/sopk_gfx9.txt new file mode 100644 index 000000000000..1e7d8901b8bf --- /dev/null +++ b/llvm/test/MC/Disassembler/AMDGPU/sopk_gfx9.txt @@ -0,0 +1,4 @@ +# RUN: llvm-mc -arch=amdgcn -mcpu=gfx900 -disassemble -show-encoding < %s | FileCheck %s -check-prefix=GFX9 + +# GFX9: s_endpgm_ordered_ps_done ; encoding: [0x00,0x00,0x9e,0xbf] +0x00,0x00,0x9e,0xbf