See bug 41156: https://bugs.llvm.org/show_bug.cgi?id=41156
This is the first part of a fix. This change corrects the following bug: when a constant expression starts with a "-" followed by a number, the negation operation is applied to the whole expression rather than to the first number.
For example, the sequence
s_sub_u32 s0, s0, -2+1
results in the same code as the following:
s_sub_u32 s0, s0, -3
This change also disables expressions which start with floating-point literals (with an optional sign).
Examples of enabled operands:
Examples of disabled operands:
-1.0 + x
Without this change we cannot correctly handle negative floating-point literals like -1.0 because
llvm does not support fp operations: operands of expressions are handled as integers.
- we cannot use llvm expressions parser for handling fp literals because unary "-" would be handled as an integer negation.
- we cannot handle unary "-" ourselves as it may start an expression (e.g. "-1.0 + x").