forked from OSchip/llvm-project
Switch the comment syntax from ; to // comments as discussed on Friday. There
is no strong reason to prefer one or the other, but // is nice for consistency given the rest of the compiler is written in C++. PiperOrigin-RevId: 204628476
This commit is contained in:
parent
ad9894a2fd
commit
c4f35a6605
|
@ -100,7 +100,11 @@ Token Lexer::lexToken() {
|
|||
|
||||
return formToken(Token::question, tokStart);
|
||||
|
||||
case ';': return lexComment();
|
||||
case '/':
|
||||
if (*curPtr == '/')
|
||||
return lexComment();
|
||||
return emitError(tokStart, "unexpected character");
|
||||
|
||||
case '@': return lexAtIdentifier(tokStart);
|
||||
case '#':
|
||||
LLVM_FALLTHROUGH;
|
||||
|
@ -119,6 +123,10 @@ Token Lexer::lexToken() {
|
|||
/// TODO: add a regex for comments here and to the spec.
|
||||
///
|
||||
Token Lexer::lexComment() {
|
||||
// Advance over the second '/' in a '//' comment.
|
||||
assert(*curPtr == '/');
|
||||
++curPtr;
|
||||
|
||||
while (true) {
|
||||
switch (*curPtr++) {
|
||||
case '\n':
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; TODO(andydavis) Resolve relative path issue w.r.t invoking mlir-opt in RUN
|
||||
; statements (perhaps through using lit config substitutions).
|
||||
;
|
||||
; RUN: %S/../../mlir-opt --help | FileCheck %s
|
||||
;
|
||||
; CHECK: OVERVIEW: MLIR modular optimizer driver
|
||||
// TODO(andydavis) Resolve relative path issue w.r.t invoking mlir-opt in RUN
|
||||
// statements (perhaps through using lit config substitutions).
|
||||
//
|
||||
// RUN: %S/../../mlir-opt --help | FileCheck %s
|
||||
//
|
||||
// CHECK: OVERVIEW: MLIR modular optimizer driver
|
||||
|
||||
|
|
|
@ -1,122 +1,122 @@
|
|||
;
|
||||
; RUN: %S/../../mlir-opt %s -o - -check-parser-errors
|
||||
//
|
||||
// RUN: %S/../../mlir-opt %s -o - -check-parser-errors
|
||||
|
||||
; Check different error cases.
|
||||
; -----
|
||||
#hello_world = (i, j) -> ((), j) ; expected-error {{no expression inside parentheses}}
|
||||
// Check different error cases.
|
||||
// -----
|
||||
#hello_world = (i, j) -> ((), j) // expected-error {{no expression inside parentheses}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) -> (->, j) ; expected-error {{expected affine expression}}
|
||||
// -----
|
||||
#hello_world = (i, j) -> (->, j) // expected-error {{expected affine expression}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) -> (:) ; expected-error {{expected affine expression}}
|
||||
// -----
|
||||
#hello_world = (i, j) -> (:) // expected-error {{expected affine expression}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) -> (, j) ; expected-error {{expected affine expression}}
|
||||
// -----
|
||||
#hello_world = (i, j) -> (, j) // expected-error {{expected affine expression}}
|
||||
|
||||
; -----
|
||||
#hello_world (i, j) [s0] -> (i, j) ; expected-error {{expected '=' in affine map outlined definition}}
|
||||
// -----
|
||||
#hello_world (i, j) [s0] -> (i, j) // expected-error {{expected '=' in affine map outlined definition}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0] -> (2*i*, 3*j*i*2 + 5) ; expected-error {{missing right operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0] -> (2*i*, 3*j*i*2 + 5) // expected-error {{missing right operand of binary op}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0] -> (i+, i+j+2 + 5) ; expected-error {{missing right operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0] -> (i+, i+j+2 + 5) // expected-error {{missing right operand of binary op}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0] -> ((s0 + i, j) ; expected-error {{expected ')'}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0] -> ((s0 + i, j) // expected-error {{expected ')'}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0] -> (((s0 + (i + j) + 5), j) ; expected-error {{expected ')'}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0] -> (((s0 + (i + j) + 5), j) // expected-error {{expected ')'}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0] -> i + s0, j) ; expected-error {{expected '(' at start of affine map range}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0] -> i + s0, j) // expected-error {{expected '(' at start of affine map range}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0] -> (x) ; expected-error {{use of undeclared identifier}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0] -> (x) // expected-error {{use of undeclared identifier}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j, i) [s0] -> (i) ; expected-error {{dimensional identifier name reused}}
|
||||
// -----
|
||||
#hello_world = (i, j, i) [s0] -> (i) // expected-error {{dimensional identifier name reused}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1, s0] -> (i) ; expected-error {{symbolic identifier name reused}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1, s0] -> (i) // expected-error {{symbolic identifier name reused}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [i, s0] -> (j) ; expected-error {{dimensional identifier name reused}}
|
||||
// -----
|
||||
#hello_world = (i, j) [i, s0] -> (j) // expected-error {{dimensional identifier name reused}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> () ; expected-error {{expected list element}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> () // expected-error {{expected list element}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (+i, j) ; expected-error {{missing left operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (+i, j) // expected-error {{missing left operand of binary op}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, *j) ; expected-error {{missing left operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, *j) // expected-error {{missing left operand of binary op}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (floordiv i 2, j) ; expected-error {{missing left operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (floordiv i 2, j) // expected-error {{missing left operand of binary op}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (ceildiv i 2, j) ; expected-error {{missing left operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (ceildiv i 2, j) // expected-error {{missing left operand of binary op}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (mod i 2, j) ; expected-error {{missing left operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (mod i 2, j) // expected-error {{missing left operand of binary op}}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (-(), j)
|
||||
; expected-error@-1 {{no expression inside parentheses}}
|
||||
; expected-error@-2 {{missing operand of negation}}
|
||||
// expected-error@-1 {{no expression inside parentheses}}
|
||||
// expected-error@-2 {{missing operand of negation}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, *j+5) ; expected-error {{missing left operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, *j+5) // expected-error {{missing left operand of binary op}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, floordiv j+5) ; expected-error {{missing left operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, floordiv j+5) // expected-error {{missing left operand of binary op}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, ceildiv j+5) ; expected-error {{missing left operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, ceildiv j+5) // expected-error {{missing left operand of binary op}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, mod j+5) ; expected-error {{missing left operand of binary op}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, mod j+5) // expected-error {{missing left operand of binary op}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i*j, j) ; expected-error {{non-affine expression: at least one of the multiply operands has to be either a constant or symbolic}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i*j, j) // expected-error {{non-affine expression: at least one of the multiply operands has to be either a constant or symbolic}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, j + j ceildiv 128 mod 16 * i - 4) ; expected-error {{non-affine expression: at least one of the multiply operands has to be either a constant or symbolic}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, j + j ceildiv 128 mod 16 * i - 4) // expected-error {{non-affine expression: at least one of the multiply operands has to be either a constant or symbolic}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, j floordiv i) ; expected-error {{non-affine expression: right operand of floordiv has to be either a constant or symbolic}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, j floordiv i) // expected-error {{non-affine expression: right operand of floordiv has to be either a constant or symbolic}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, i*2 ceildiv j*5) ; expected-error {{non-affine expression: right operand of ceildiv has to be either a constant or symbolic}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, i*2 ceildiv j*5) // expected-error {{non-affine expression: right operand of ceildiv has to be either a constant or symbolic}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, i mod (2+i)) ; expected-error {{non-affine expression: right operand of mod has to be either a constant or symbolic}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (i, i mod (2+i)) // expected-error {{non-affine expression: right operand of mod has to be either a constant or symbolic}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [s0, s1] -> (-1*i j, j) ; expected-error {{expected ',' or ')'}}
|
||||
// -----
|
||||
#hello_world = (i, j) [s0, s1] -> (-1*i j, j) // expected-error {{expected ',' or ')'}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) -> (i, 3*d0 + ) ; expected-error {{use of undeclared identifier}}
|
||||
// -----
|
||||
#hello_world = (i, j) -> (i, 3*d0 + ) // expected-error {{use of undeclared identifier}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) -> (i, j) size (10, x) ; expected-error {{use of undeclared identifier}}
|
||||
// -----
|
||||
#hello_world = (i, j) -> (i, j) size (10, x) // expected-error {{use of undeclared identifier}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [M] -> (i, j) size (10, j) ; expected-error {{identifier used is not a symbolic identifier}}
|
||||
// -----
|
||||
#hello_world = (i, j) [M] -> (i, j) size (10, j) // expected-error {{identifier used is not a symbolic identifier}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) [M] -> (i, j) size (10, M+i) ; expected-error {{identifier used is not a symbolic identifier}}
|
||||
// -----
|
||||
#hello_world = (i, j) [M] -> (i, j) size (10, M+i) // expected-error {{identifier used is not a symbolic identifier}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) -> (i, j) size (10) ; expected-error {{fewer range sizes than range expressions}}
|
||||
// -----
|
||||
#hello_world = (i, j) -> (i, j) size (10) // expected-error {{fewer range sizes than range expressions}}
|
||||
|
||||
; -----
|
||||
#hello_world = (i, j) -> (i, j) size (10, 20, 30) ; expected-error {{more range sizes than range expressions}}
|
||||
// -----
|
||||
#hello_world = (i, j) -> (i, j) size (10, 20, 30) // expected-error {{more range sizes than range expressions}}
|
||||
|
||||
; TODO(bondhugula): Add more tests; coverage of error messages emitted not complete
|
||||
// TODO(bondhugula): Add more tests; coverage of error messages emitted not complete
|
||||
|
||||
; -----
|
||||
// -----
|
||||
#ABC = (i,j) -> (i+j)
|
||||
#ABC = (i,j) -> (i+j) ; expected-error {{redefinition of affine map id 'ABC'}}
|
||||
#ABC = (i,j) -> (i+j) // expected-error {{redefinition of affine map id 'ABC'}}
|
||||
|
|
|
@ -1,121 +1,121 @@
|
|||
; RUN: %S/../../mlir-opt %s -o - | FileCheck %s
|
||||
// RUN: %S/../../mlir-opt %s -o - | FileCheck %s
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> (d0, d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> (d0, d1)
|
||||
#hello_world0 = (i, j) -> (i, j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (d0, d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (d0, d1)
|
||||
#hello_world1 = (i, j) [s0] -> (i, j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = () -> (0)
|
||||
// CHECK: #{{[0-9]+}} = () -> (0)
|
||||
#hello_world2 = () -> (0)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> ((d0 + 1), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> ((d0 + 1), d1)
|
||||
#hello_world3 = (i, j) -> (i+1, j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((d0 + s0), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((d0 + s0), d1)
|
||||
#hello_world4 = (i, j) [s0] -> (i + s0, j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> ((d0 + 1), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> ((d0 + 1), d1)
|
||||
#hello_world5 = (i, j) -> (1+i, j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((d0 + s0), (d1 + 5))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((d0 + s0), (d1 + 5))
|
||||
#hello_world6 = (i, j) [s0] -> (i + s0, j + 5)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (((d0 + d1) + s0), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (((d0 + d1) + s0), d1)
|
||||
#hello_world7 = (i, j) [s0] -> (i + j + s0, j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((((d0 + 5) + d1) + s0), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((((d0 + 5) + d1) + s0), d1)
|
||||
#hello_world8 = (i, j) [s0] -> (5 + i + j + s0, j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (((d0 + d1) + 5), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (((d0 + d1) + 5), d1)
|
||||
#hello_world9 = (i, j) [s0] -> ((i + j) + 5, j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((d0 + (d1 + 5)), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((d0 + (d1 + 5)), d1)
|
||||
#hello_world10 = (i, j) [s0] -> (i + (j + 5), j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((d0 * 2), (d1 * 3))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((d0 * 2), (d1 * 3))
|
||||
#hello_world11 = (i, j) [s0] -> (2*i, 3*j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (((d0 + 12) + ((d1 + (s0 * 3)) * 5)), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (((d0 + 12) + ((d1 + (s0 * 3)) * 5)), d1)
|
||||
#hello_world12 = (i, j) [s0] -> (i + 2*6 + 5*(j+s0*3), j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (((d0 * 5) + d1), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (((d0 * 5) + d1), d1)
|
||||
#hello_world13 = (i, j) [s0] -> (5*i + j, j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((d0 + d1), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((d0 + d1), d1)
|
||||
#hello_world14 = (i, j) [s0] -> ((i + j), (j))
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (((d0 + d1) + 5), (d1 + 3))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (((d0 + d1) + 5), (d1 + 3))
|
||||
#hello_world15 = (i, j) [s0] -> ((i + j)+5, (j)+3)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (d0, 0)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (d0, 0)
|
||||
#hello_world16 = (i, j) [s1] -> (i, 0)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (d0, (d1 * s0))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (d0, (d1 * s0))
|
||||
#hello_world17 = (i, j) [s0] -> (i, s0*j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> (d0, ((d0 * 3) + d1))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> (d0, ((d0 * 3) + d1))
|
||||
#hello_world19 = (i, j) -> (i, 3*i + j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> (d0, (d0 + (d1 * 3)))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> (d0, (d0 + (d1 * 3)))
|
||||
#hello_world20 = (i, j) -> (i, i + 3*j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (d0, (((d0 * ((s0 * s0) * 9)) + 2) + 1))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> (d0, (((d0 * ((s0 * s0) * 9)) + 2) + 1))
|
||||
#hello_world18 = (i, j) [N] -> (i, 2 + N*N*9*i + 1)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> (1, ((d0 + (d1 * 3)) + 5))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> (1, ((d0 + (d1 * 3)) + 5))
|
||||
#hello_world21 = (i, j) -> (1, i + 3*j + 5)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((s0 * 5), ((d0 + (d1 * 3)) + (d0 * 5)))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0] -> ((s0 * 5), ((d0 + (d1 * 3)) + (d0 * 5)))
|
||||
#hello_world22 = (i, j) [s0] -> (5*s0, i + 3*j + 5*i)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> ((d0 * (s0 * s1)), d1)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> ((d0 * (s0 * s1)), d1)
|
||||
#hello_world23 = (i, j) [s0, s1] -> (i*(s0*s1), j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, (d1 mod 5))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, (d1 mod 5))
|
||||
#hello_world24 = (i, j) [s0, s1] -> (i, j mod 5)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, (d1 floordiv 5))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, (d1 floordiv 5))
|
||||
#hello_world25 = (i, j) [s0, s1] -> (i, j floordiv 5)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, (d1 ceildiv 5))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, (d1 ceildiv 5))
|
||||
#hello_world26 = (i, j) [s0, s1] -> (i, j ceildiv 5)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, ((d0 - d1) - 5))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, ((d0 - d1) - 5))
|
||||
#hello_world29 = (i, j) [s0, s1] -> (i, i - j - 5)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, ((d0 - (d1 * s1)) + 2))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, ((d0 - (d1 * s1)) + 2))
|
||||
#hello_world30 = (i, j) [M, N] -> (i, i - N*j + 2)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> ((d0 * -5), (d1 * -3), -2, ((d0 + d1) * -1), (s0 * -1))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> ((d0 * -5), (d1 * -3), -2, ((d0 + d1) * -1), (s0 * -1))
|
||||
#hello_world32 = (i, j) [s0, s1] -> (-5*i, -3*j, -2, -1*(i+j), -1*s0)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> (-4, (d0 * -1))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> (-4, (d0 * -1))
|
||||
#hello_world33 = (i, j) -> (-2+-5-(-3), -1*i)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, (d1 floordiv s0), (d1 mod s0))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, (d1 floordiv s0), (d1 mod s0))
|
||||
#hello_world34 = (i, j) [s0, s1] -> (i, j floordiv s0, j mod s0)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1, d2) [s0, s1, s2] -> (((((d0 * s1) * s2) + (d1 * s1)) + d2))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1, d2) [s0, s1, s2] -> (((((d0 * s1) * s2) + (d1 * s1)) + d2))
|
||||
#hello_world35 = (i, j, k) [s0, s1, s2] -> (i*s1*s2 + j*s1 + k)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> (8, 4, 1, 3, 2, 4)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> (8, 4, 1, 3, 2, 4)
|
||||
#hello_world36 = (i, j) -> (5+3, 2*2, 8-7, 100 floordiv 32, 5 mod 3, 10 ceildiv 3)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> (4, 11, 512, 15)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> (4, 11, 512, 15)
|
||||
#hello_world37 = (i, j) -> (5 mod 3 + 2, 5*3 - 4, 128 * (500 ceildiv 128), 40 floordiv 7 * 3)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> (((d0 * 2) + 1), (d1 + 2))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> (((d0 * 2) + 1), (d1 + 2))
|
||||
#hello_world38 = (i, j) -> (1 + i*2, 2 + j)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> ((d0 * s0), (d0 + s0), (d0 + 2), (d1 * 2), (s1 * 2), (s0 + 2))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> ((d0 * s0), (d0 + s0), (d0 + 2), (d1 * 2), (s1 * 2), (s0 + 2))
|
||||
#hello_world39 = (i, j) [M, N] -> (i*M, M + i, 2+i, j*2, N*2, 2 + M)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) -> (d0, d1) size (10, 20)
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) -> (d0, d1) size (10, 20)
|
||||
#hello_world40 = (i, j) -> (i, j) size (10, 20)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, d1) size (s0, (s1 + 10))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, d1) size (s0, (s1 + 10))
|
||||
#hello_world41 = (i, j) [N, M] -> (i, j) size (N, M+10)
|
||||
|
||||
; CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, d1) size (128, (((s0 * 2) + 5) + s1))
|
||||
// CHECK: #{{[0-9]+}} = (d0, d1) [s0, s1] -> (d0, d1) size (128, (((s0 * 2) + 5) + s1))
|
||||
#hello_world42 = (i, j) [N, M] -> (i, j) size (64 + 64, 5 + 2*N + M)
|
||||
|
|
|
@ -1,107 +1,107 @@
|
|||
; TODO(andydavis) Resolve relative path issue w.r.t invoking mlir-opt in RUN
|
||||
; statements (perhaps through using lit config substitutions).
|
||||
;
|
||||
; RUN: %S/../../mlir-opt %s -o - -check-parser-errors
|
||||
// TODO(andydavis) Resolve relative path issue w.r.t invoking mlir-opt in RUN
|
||||
// statements (perhaps through using lit config substitutions).
|
||||
//
|
||||
// RUN: %S/../../mlir-opt %s -o - -check-parser-errors
|
||||
|
||||
; Check different error cases.
|
||||
; -----
|
||||
// Check different error cases.
|
||||
// -----
|
||||
|
||||
extfunc @illegaltype(i) ; expected-error {{expected type}}
|
||||
extfunc @illegaltype(i) // expected-error {{expected type}}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
extfunc @nestedtensor(tensor<tensor<i8>>) -> () ; expected-error {{expected type}}
|
||||
extfunc @nestedtensor(tensor<tensor<i8>>) -> () // expected-error {{expected type}}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
cfgfunc @foo()
|
||||
cfgfunc @bar() ; expected-error {{expected '{' in CFG function}}
|
||||
cfgfunc @bar() // expected-error {{expected '{' in CFG function}}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
extfunc missingsigil() -> (i1, affineint, f32) ; expected-error {{expected a function identifier like}}
|
||||
extfunc missingsigil() -> (i1, affineint, f32) // expected-error {{expected a function identifier like}}
|
||||
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
cfgfunc @bad_branch() {
|
||||
bb42:
|
||||
br missing ; expected-error {{reference to an undefined basic block 'missing'}}
|
||||
br missing // expected-error {{reference to an undefined basic block 'missing'}}
|
||||
}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
cfgfunc @block_redef() {
|
||||
bb42:
|
||||
return
|
||||
bb42: ; expected-error {{redefinition of block 'bb42'}}
|
||||
bb42: // expected-error {{redefinition of block 'bb42'}}
|
||||
return
|
||||
}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
cfgfunc @no_terminator() {
|
||||
bb40:
|
||||
return
|
||||
bb41:
|
||||
bb42: ; expected-error {{expected operation name}}
|
||||
bb42: // expected-error {{expected operation name}}
|
||||
return
|
||||
}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
mlfunc @foo()
|
||||
mlfunc @bar() ; expected-error {{expected '{' in ML function}}
|
||||
mlfunc @bar() // expected-error {{expected '{' in ML function}}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
mlfunc @no_return() {
|
||||
} ; expected-error {{ML function must end with return statement}}
|
||||
} // expected-error {{ML function must end with return statement}}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
" ; expected-error {{expected}}
|
||||
" // expected-error {{expected}}
|
||||
"
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
" ; expected-error {{expected}}
|
||||
" // expected-error {{expected}}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
cfgfunc @no_terminator() {
|
||||
bb40:
|
||||
"foo"()
|
||||
""() ; expected-error {{empty operation name is invalid}}
|
||||
""() // expected-error {{empty operation name is invalid}}
|
||||
return
|
||||
}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
extfunc @illegaltype(i0) ; expected-error {{invalid integer width}}
|
||||
extfunc @illegaltype(i0) // expected-error {{invalid integer width}}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
mlfunc @incomplete_for() {
|
||||
for
|
||||
} ; expected-error {{expected '{' before statement list}}
|
||||
} // expected-error {{expected '{' before statement list}}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
mlfunc @non_statement() {
|
||||
asd ; expected-error {{expected statement}}
|
||||
asd // expected-error {{expected statement}}
|
||||
}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
cfgfunc @malformed_dim() {
|
||||
bb42:
|
||||
"dim"(){index: "xyz"} ; expected-error {{'dim' op requires an integer attribute named 'index'}}
|
||||
"dim"(){index: "xyz"} // expected-error {{'dim' op requires an integer attribute named 'index'}}
|
||||
return
|
||||
}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
||||
#map = (d0) -> (% ; expected-error {{invalid SSA name}}
|
||||
#map = (d0) -> (% // expected-error {{invalid SSA name}}
|
||||
|
||||
; -----
|
||||
// -----
|
||||
|
|
|
@ -1,107 +1,107 @@
|
|||
; TODO(andydavis) Resolve relative path issue w.r.t invoking mlir-opt in RUN
|
||||
; statements (perhaps through using lit config substitutions).
|
||||
;
|
||||
; RUN: %S/../../mlir-opt %s -o - | FileCheck %s
|
||||
// TODO(andydavis) Resolve relative path issue w.r.t invoking mlir-opt in RUN
|
||||
// statements (perhaps through using lit config substitutions).
|
||||
//
|
||||
// RUN: %S/../../mlir-opt %s -o - | FileCheck %s
|
||||
|
||||
|
||||
; CHECK: extfunc @foo(i32, i64) -> f32
|
||||
// CHECK: extfunc @foo(i32, i64) -> f32
|
||||
extfunc @foo(i32, i64) -> f32
|
||||
|
||||
; CHECK: extfunc @bar()
|
||||
// CHECK: extfunc @bar()
|
||||
extfunc @bar() -> ()
|
||||
|
||||
; CHECK: extfunc @baz() -> (i1, affineint, f32)
|
||||
// CHECK: extfunc @baz() -> (i1, affineint, f32)
|
||||
extfunc @baz() -> (i1, affineint, f32)
|
||||
|
||||
; CHECK: extfunc @missingReturn()
|
||||
// CHECK: extfunc @missingReturn()
|
||||
extfunc @missingReturn()
|
||||
|
||||
; CHECK: extfunc @int_types(i1, i2, i4, i7, i87) -> (i1, affineint, i19)
|
||||
// CHECK: extfunc @int_types(i1, i2, i4, i7, i87) -> (i1, affineint, i19)
|
||||
extfunc @int_types(i1, i2, i4, i7, i87) -> (i1, affineint, i19)
|
||||
|
||||
|
||||
; CHECK: extfunc @vectors(vector<1xf32>, vector<2x4xf32>)
|
||||
// CHECK: extfunc @vectors(vector<1xf32>, vector<2x4xf32>)
|
||||
extfunc @vectors(vector<1 x f32>, vector<2x4xf32>)
|
||||
|
||||
; CHECK: extfunc @tensors(tensor<??f32>, tensor<??vector<2x4xf32>>, tensor<1x?x4x?x?xaffineint>, tensor<i8>)
|
||||
// CHECK: extfunc @tensors(tensor<??f32>, tensor<??vector<2x4xf32>>, tensor<1x?x4x?x?xaffineint>, tensor<i8>)
|
||||
extfunc @tensors(tensor<?? f32>, tensor<?? vector<2x4xf32>>,
|
||||
tensor<1x?x4x?x?xaffineint>, tensor<i8>)
|
||||
|
||||
; CHECK: extfunc @memrefs(i1, i1)
|
||||
// CHECK: extfunc @memrefs(i1, i1)
|
||||
extfunc @memrefs(memref<1x?x4x?x?xaffineint>, memref<i8>)
|
||||
|
||||
; CHECK: extfunc @functions((i1, i1) -> (), () -> ())
|
||||
// CHECK: extfunc @functions((i1, i1) -> (), () -> ())
|
||||
extfunc @functions((memref<1x?x4x?x?xaffineint>, memref<i8>) -> (), ()->())
|
||||
|
||||
|
||||
; CHECK-LABEL: cfgfunc @simpleCFG(i32, f32) {
|
||||
// CHECK-LABEL: cfgfunc @simpleCFG(i32, f32) {
|
||||
cfgfunc @simpleCFG(i32, f32) {
|
||||
bb42(%0: i32, %f: f32): ; CHECK: bb0:
|
||||
%1 = "foo"(%0) ; CHECK: "foo"()
|
||||
"bar"(%1, %f) ; CHECK: "bar"()
|
||||
return ; CHECK: return
|
||||
} ; CHECK: }
|
||||
bb42(%0: i32, %f: f32): // CHECK: bb0:
|
||||
%1 = "foo"(%0) // CHECK: "foo"()
|
||||
"bar"(%1, %f) // CHECK: "bar"()
|
||||
return // CHECK: return
|
||||
} // CHECK: }
|
||||
|
||||
; CHECK-LABEL: cfgfunc @multiblock() -> i32 {
|
||||
// CHECK-LABEL: cfgfunc @multiblock() -> i32 {
|
||||
cfgfunc @multiblock() -> i32 {
|
||||
bb0: ; CHECK: bb0:
|
||||
return ; CHECK: return
|
||||
bb1: ; CHECK: bb1:
|
||||
br bb4 ; CHECK: br bb3
|
||||
bb2: ; CHECK: bb2:
|
||||
br bb2 ; CHECK: br bb2
|
||||
bb4: ; CHECK: bb3:
|
||||
return ; CHECK: return
|
||||
} ; CHECK: }
|
||||
bb0: // CHECK: bb0:
|
||||
return // CHECK: return
|
||||
bb1: // CHECK: bb1:
|
||||
br bb4 // CHECK: br bb3
|
||||
bb2: // CHECK: bb2:
|
||||
br bb2 // CHECK: br bb2
|
||||
bb4: // CHECK: bb3:
|
||||
return // CHECK: return
|
||||
} // CHECK: }
|
||||
|
||||
; CHECK-LABEL: mlfunc @simpleMLF() {
|
||||
// CHECK-LABEL: mlfunc @simpleMLF() {
|
||||
mlfunc @simpleMLF() {
|
||||
return ; CHECK: return
|
||||
} ; CHECK: }
|
||||
return // CHECK: return
|
||||
} // CHECK: }
|
||||
|
||||
; CHECK-LABEL: mlfunc @loops() {
|
||||
// CHECK-LABEL: mlfunc @loops() {
|
||||
mlfunc @loops() {
|
||||
for { ; CHECK: for {
|
||||
for { ; CHECK: for {
|
||||
} ; CHECK: }
|
||||
} ; CHECK: }
|
||||
return ; CHECK: return
|
||||
} ; CHECK: }
|
||||
for { // CHECK: for {
|
||||
for { // CHECK: for {
|
||||
} // CHECK: }
|
||||
} // CHECK: }
|
||||
return // CHECK: return
|
||||
} // CHECK: }
|
||||
|
||||
; CHECK-LABEL: mlfunc @ifstmt() {
|
||||
// CHECK-LABEL: mlfunc @ifstmt() {
|
||||
mlfunc @ifstmt() {
|
||||
for { ; CHECK for {
|
||||
if () { ; CHECK if () {
|
||||
} else if () { ; CHECK } else if () {
|
||||
} else { ; CHECK } else {
|
||||
} ; CHECK }
|
||||
} ; CHECK }
|
||||
return ; CHECK return
|
||||
} ; CHECK }
|
||||
for { // CHECK for {
|
||||
if () { // CHECK if () {
|
||||
} else if () { // CHECK } else if () {
|
||||
} else { // CHECK } else {
|
||||
} // CHECK }
|
||||
} // CHECK }
|
||||
return // CHECK return
|
||||
} // CHECK }
|
||||
|
||||
; CHECK-LABEL: cfgfunc @attributes() {
|
||||
// CHECK-LABEL: cfgfunc @attributes() {
|
||||
cfgfunc @attributes() {
|
||||
bb42: ; CHECK: bb0:
|
||||
bb42: // CHECK: bb0:
|
||||
|
||||
; CHECK: "foo"()
|
||||
// CHECK: "foo"()
|
||||
"foo"(){}
|
||||
|
||||
; CHECK: "foo"(){a: 1, b: -423, c: [true, false]}
|
||||
// CHECK: "foo"(){a: 1, b: -423, c: [true, false]}
|
||||
"foo"(){a: 1, b: -423, c: [true, false] }
|
||||
|
||||
; CHECK: "foo"(){cfgfunc: [], i123: 7, if: "foo"}
|
||||
// CHECK: "foo"(){cfgfunc: [], i123: 7, if: "foo"}
|
||||
"foo"(){if: "foo", cfgfunc: [], i123: 7}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
; CHECK-LABEL: cfgfunc @standard_instrs() {
|
||||
// CHECK-LABEL: cfgfunc @standard_instrs() {
|
||||
cfgfunc @standard_instrs() {
|
||||
bb42: ; CHECK: bb0:
|
||||
; CHECK: dim xxx, 2 : sometype
|
||||
bb42: // CHECK: bb0:
|
||||
// CHECK: dim xxx, 2 : sometype
|
||||
%a = "dim"(%42){index: 2}
|
||||
|
||||
; CHECK: addf xx, yy : sometype
|
||||
// CHECK: addf xx, yy : sometype
|
||||
"addf"()
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue