[llvm] r321372 - [AMDGPU][MC] Corrected handling of negative expressions
Dmitry Preobrazhensky via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 22 10:03:35 PST 2017
Author: dpreobra
Date: Fri Dec 22 10:03:35 2017
New Revision: 321372
URL: http://llvm.org/viewvc/llvm-project?rev=321372&view=rev
Log:
[AMDGPU][MC] Corrected handling of negative expressions
See bug 35716: https://bugs.llvm.org/show_bug.cgi?id=35716
Reviewers: artem.tamazov, arsenm
Differential Revision: https://reviews.llvm.org/D41488
Modified:
llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
llvm/trunk/test/MC/AMDGPU/expressions.s
llvm/trunk/test/MC/AMDGPU/vop3p-err.s
Modified: llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp?rev=321372&r1=321371&r2=321372&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp Fri Dec 22 10:03:35 2017
@@ -1760,6 +1760,11 @@ AMDGPUAsmParser::parseImm(OperandVector
// TODO: add syntactic sugar for 1/(2*PI)
bool Minus = false;
if (getLexer().getKind() == AsmToken::Minus) {
+ const AsmToken NextToken = getLexer().peekTok();
+ if (!NextToken.is(AsmToken::Integer) &&
+ !NextToken.is(AsmToken::Real)) {
+ return MatchOperand_NoMatch;
+ }
Minus = true;
Parser.Lex();
}
@@ -1789,7 +1794,7 @@ AMDGPUAsmParser::parseImm(OperandVector
return MatchOperand_Success;
}
default:
- return Minus ? MatchOperand_ParseFail : MatchOperand_NoMatch;
+ return MatchOperand_NoMatch;
}
}
Modified: llvm/trunk/test/MC/AMDGPU/expressions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AMDGPU/expressions.s?rev=321372&r1=321371&r2=321372&view=diff
==============================================================================
--- llvm/trunk/test/MC/AMDGPU/expressions.s (original)
+++ llvm/trunk/test/MC/AMDGPU/expressions.s Fri Dec 22 10:03:35 2017
@@ -46,3 +46,11 @@ BB2:
s_sub_u32 vcc_lo, vcc_lo, (BB2+4)-BB1
// VI: s_sub_u32 vcc_lo, vcc_lo, (BB2+4)-BB1 ; encoding: [0x6a,0xff,0xea,0x80,A,A,A,A]
// VI-NEXT: ; fixup A - offset: 4, value: (BB2+4)-BB1, kind: FK_Data_4
+
+t=1
+s_sub_u32 s0, s0, -t
+// VI: s_sub_u32 s0, s0, -1 ; encoding: [0x00,0xc1,0x80,0x80]
+
+t=-1
+s_sub_u32 s0, s0, -t
+// VI: s_sub_u32 s0, s0, 1 ; encoding: [0x00,0x81,0x80,0x80]
Modified: llvm/trunk/test/MC/AMDGPU/vop3p-err.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AMDGPU/vop3p-err.s?rev=321372&r1=321371&r2=321372&view=diff
==============================================================================
--- llvm/trunk/test/MC/AMDGPU/vop3p-err.s (original)
+++ llvm/trunk/test/MC/AMDGPU/vop3p-err.s Fri Dec 22 10:03:35 2017
@@ -59,16 +59,16 @@ v_pk_add_f16 v1, v2, |v3|
// GFX9: :22: error: invalid operand for instruction
v_pk_add_f16 v1, v2, abs(v3)
-// GFX9: :19: error: invalid operand for instruction
+// GFX9: :18: error: invalid operand for instruction
v_pk_add_f16 v1, -v2, v3
-// GFX9: :23: error: invalid operand for instruction
+// GFX9: :22: error: invalid operand for instruction
v_pk_add_f16 v1, v2, -v3
// GFX9: :18: error: invalid operand for instruction
v_pk_add_u16 v1, abs(v2), v3
-// GFX9: :19: error: invalid operand for instruction
+// GFX9: :18: error: invalid operand for instruction
v_pk_add_u16 v1, -v2, v3
//
More information about the llvm-commits
mailing list