diff --git a/llvm/lib/Support/FileCheck.cpp b/llvm/lib/Support/FileCheck.cpp --- a/llvm/lib/Support/FileCheck.cpp +++ b/llvm/lib/Support/FileCheck.cpp @@ -304,6 +304,10 @@ return LeftOp + RightOp; } +static uint64_t mul(uint64_t LeftOp, uint64_t RightOp) { + return LeftOp * RightOp; +} + static uint64_t sub(uint64_t LeftOp, uint64_t RightOp) { return LeftOp - RightOp; } @@ -329,6 +333,9 @@ case '-': EvalBinop = sub; break; + case '*': + EvalBinop = mul; + break; default: return ErrorDiagnostic::get( SM, OpLoc, Twine("unsupported operation '") + Twine(Operator) + "'"); diff --git a/llvm/test/FileCheck/line-count.txt b/llvm/test/FileCheck/line-count.txt --- a/llvm/test/FileCheck/line-count.txt +++ b/llvm/test/FileCheck/line-count.txt @@ -46,8 +46,8 @@ 46 BAD8: [[@LIN]] 47 ERR8: line-count.txt:[[#@LINE-1]]:12: error: invalid pseudo numeric variable '@LIN' 48 -49 BAD9: [[@LINE*2]] -50 ERR9: line-count.txt:[[#@LINE-1]]:17: error: unsupported operation '*' +49 BAD9: [[@LINE%2]] +50 ERR9: line-count.txt:[[#@LINE-1]]:17: error: unsupported operation '%' 51 52 BAD10: [[@LINE-x]] 53 ERR10: line-count.txt:[[#@LINE-1]]:19: error: invalid operand format 'x' diff --git a/llvm/test/FileCheck/numeric-expression.txt b/llvm/test/FileCheck/numeric-expression.txt --- a/llvm/test/FileCheck/numeric-expression.txt +++ b/llvm/test/FileCheck/numeric-expression.txt @@ -67,14 +67,17 @@ 11 12 10 +33 c d b 1a +c0 D E C 1B +D0 11 11 11 @@ -87,14 +90,17 @@ CHECK-NEXT: [[#%u,VAR1]] CHECK-NEXT: [[#%u,VAR1+1]] CHECK-NEXT: [[#%u,VAR1-1]] +CHECK-NEXT: [[#%u,VAR1*3]] CHECK-NEXT: [[#%x,VAR2]] CHECK-NEXT: [[#%x,VAR2+1]] CHECK-NEXT: [[#%x,VAR2-1]] CHECK-NEXT: [[#%x,VAR2+14]] +CHECK-NEXT: [[#%x,VAR2*16]] CHECK-NEXT: [[#%X,VAR3]] CHECK-NEXT: [[#%X,VAR3+1]] CHECK-NEXT: [[#%X,VAR3-1]] CHECK-NEXT: [[#%X,VAR3+14]] +CHECK-NEXT: [[#%X,VAR3*16]] CHECK-NEXT: [[#%u,VAR1a]] CHECK-NEXT: [[#%u,VAR1b]] CHECK-NEXT: [[#%u,VAR1c]] @@ -118,6 +124,12 @@ 10 10 10 +22 +22 +22 +22 +22 +22 CHECK-LABEL: USE EXPL FMT IMPL MATCH SPC CHECK-NEXT: [[#%u, VAR1]] CHECK-NEXT: [[# %u, VAR1]] @@ -134,6 +146,12 @@ CHECK-NEXT: [[# %u , VAR1 -1]] CHECK-NEXT: [[# %u , VAR1 - 1]] CHECK-NEXT: [[# %u , VAR1 - 1 ]] +CHECK-NEXT: [[#%u, VAR1*2]] +CHECK-NEXT: [[# %u, VAR1*2]] +CHECK-NEXT: [[# %u , VAR1*2]] +CHECK-NEXT: [[# %u , VAR1 *2]] +CHECK-NEXT: [[# %u , VAR1 * 2]] +CHECK-NEXT: [[# %u , VAR1 * 2 ]] ; Numeric expressions in implicit matching format and default matching rule using ; variables defined on other lines. @@ -141,26 +159,32 @@ 11 12 10 +33 c d b 1a +c0 D E C 1B +D0 CHECK-LABEL: USE IMPL FMT IMPL MATCH CHECK-NEXT: [[#VAR1]] CHECK-NEXT: [[#VAR1+1]] CHECK-NEXT: [[#VAR1-1]] +CHECK-NEXT: [[#VAR1*3]] CHECK-NEXT: [[#VAR2]] CHECK-NEXT: [[#VAR2+1]] CHECK-NEXT: [[#VAR2-1]] CHECK-NEXT: [[#VAR2+14]] +CHECK-NEXT: [[#VAR2*16]] CHECK-NEXT: [[#VAR3]] CHECK-NEXT: [[#VAR3+1]] CHECK-NEXT: [[#VAR3-1]] CHECK-NEXT: [[#VAR3+14]] +CHECK-NEXT: [[#VAR3*16]] ; Numeric expressions using variables defined on other lines and an immediate ; interpreted as an unsigned value. @@ -261,11 +285,11 @@ RUN: | FileCheck --strict-whitespace --check-prefix INVAL-OP-MSG %s INVALID OPERATOR -NUMVAR*2: 22 +NUMVAR%2: 22 INVAL-OP-LABEL: INVALID OPERATOR -INVAL-OP-NEXT: NUMVAR*2: [[#NUMVAR*2]] -INVAL-OP-MSG: numeric-expression.txt:[[#@LINE-1]]:35: error: unsupported operation '*' -INVAL-OP-MSG-NEXT: {{I}}NVAL-OP-NEXT: NUMVAR*2: {{\[\[#NUMVAR\*2\]\]}} +INVAL-OP-NEXT: NUMVAR%2: [[#NUMVAR%2]] +INVAL-OP-MSG: numeric-expression.txt:[[#@LINE-1]]:35: error: unsupported operation '%' +INVAL-OP-MSG-NEXT: {{I}}NVAL-OP-NEXT: NUMVAR%2: {{\[\[#NUMVAR\%2\]\]}} INVAL-OP-MSG-NEXT: {{^}} ^{{$}} ; Name conflict between Numeric variable definition and string variable