From 04bd1185ade596fcd7e436666693614516bf3690 Mon Sep 17 00:00:00 2001 From: Dmitry Preobrazhensky Date: Wed, 20 Mar 2019 17:13:58 +0000 Subject: [PATCH] [AMDGPU][MC] Corrected checks for DS offset0 range See bug 40889: https://bugs.llvm.org/show_bug.cgi?id=40889 Reviewers: artem.tamazov, arsenm Differential Revision: https://reviews.llvm.org/D59313 llvm-svn: 356576 --- llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | 2 +- llvm/test/MC/AMDGPU/ds-err.s | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp index 6db22f1..a9c7c7e 100644 --- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -306,7 +306,7 @@ public: bool isIdxen() const { return isImmTy(ImmTyIdxen); } bool isAddr64() const { return isImmTy(ImmTyAddr64); } bool isOffset() const { return isImmTy(ImmTyOffset) && isUInt<16>(getImm()); } - bool isOffset0() const { return isImmTy(ImmTyOffset0) && isUInt<16>(getImm()); } + bool isOffset0() const { return isImmTy(ImmTyOffset0) && isUInt<8>(getImm()); } bool isOffset1() const { return isImmTy(ImmTyOffset1) && isUInt<8>(getImm()); } bool isOffsetU12() const { return (isImmTy(ImmTyOffset) || isImmTy(ImmTyInstOffset)) && isUInt<12>(getImm()); } diff --git a/llvm/test/MC/AMDGPU/ds-err.s b/llvm/test/MC/AMDGPU/ds-err.s index 1cec62b..7ed4080 100644 --- a/llvm/test/MC/AMDGPU/ds-err.s +++ b/llvm/test/MC/AMDGPU/ds-err.s @@ -5,6 +5,10 @@ // CHECK: error: invalid operand for instruction ds_add_u32 v2, v4 offset:1000000000 +// offset too big +// CHECK: error: invalid operand for instruction +ds_add_u32 v2, v4 offset:0x10000 + // offset0 twice // CHECK: error: invalid operand for instruction ds_write2_b32 v2, v4, v6 offset0:4 offset0:8 @@ -17,10 +21,18 @@ ds_write2_b32 v2, v4, v6 offset1:4 offset1:8 // CHECK: invalid operand for instruction ds_write2_b32 v2, v4, v6 offset0:1000000000 +// offset0 too big +// CHECK: invalid operand for instruction +ds_write2_b32 v2, v4, v6 offset0:0x100 + // offset1 too big // CHECK: invalid operand for instruction ds_write2_b32 v2, v4, v6 offset1:1000000000 +// offset1 too big +// CHECK: invalid operand for instruction +ds_write2_b32 v2, v4, v6 offset1:0x100 + //===----------------------------------------------------------------------===// // swizzle //===----------------------------------------------------------------------===// -- 2.7.4