Skip to content

Commit

Permalink
test: Update conversion checks to adhere new results.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Sep 18, 2024
1 parent 0fd639d commit 3e9b913
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %vast-cc1 -vast-emit-mlir=llvm %s -o - | %file-check %s

// CHECK: llvm.func @count([[ARG:%arg[0-9]+]]: i32)
void count(int arg)
// CHECK: llvm.func @count
void count()
{
// CHECK: [[C:%[0-9]+]] = llvm.mlir.constant(1 : index) : i64
// CHECK: [[V1:%[0-9]+]] = llvm.alloca [[C]] x i32 : (i64) -> !llvm.ptr
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %vast-cc1 -vast-emit-mlir=llvm %s -o - | %file-check %s

// CHECK: llvm.func @count([[ARG:%arg[0-9]+]]: i32)
void count(int arg)
// CHECK: llvm.func @count
void count()
{
// CHECK: [[V0:%[0-9]+]] = llvm.mlir.constant(1 : index) : i64
// CHECK: [[V1:%[0-9]+]] = llvm.alloca [[V0]] x i32 : (i64) -> !llvm.ptr
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/vast/Conversion/direct-overlap-a.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int sum( struct data d )
// ABI-NEXT: [[V28:%[0-9]+]] = abi.direct [[V15]] : si32 -> si32
// ABI-NEXT: {{.*}} = abi.yield [[V28]] : si32 -> si32
// ABI-NEXT: } : si32
// ABI-NEXT: %7 = abi.yield [[V16]] : si32 -> si32
// ABI-NEXT: abi.yield [[V16]] : si32 -> si32
// ABI-NEXT: } : (!hl.elaborated<!hl.record<"data">>) -> si32
// ABI-NEXT: hl.return [[V13]] : si32

Expand Down
9 changes: 5 additions & 4 deletions test/vast/Conversion/do-while-a.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// RUN: %check-hl-to-ll-cf %s | %file-check %s -check-prefix=LL_CF
// RUN: %check-core-to-llvm %s | %file-check %s -check-prefix=C_LLVM

// LL_CF: ll.func @fn external ([[ARG0:%.*]]: !hl.lvalue<si32>) -> none {
// LL_CF: ll.func @fn external ([[ARG0:%.*]]: !hl.lvalue<si32>) -> none
// LL_CF: hl.param @a
// LL_CF: ll.scope {
// LL_CF: [[V3:%[0-9]+]] = ll.initialize {{.*}} : (!hl.lvalue<si32>, si32) -> !hl.lvalue<si32>
// LL_CF: hl.var @sum
// LL_CF: ll.scope {
// LL_CF: ll.br ^bb2
// LL_CF: ^bb1: // pred: ^bb2
// LL_CF: [[V8:%[0-9]+]] = hl.ref [[ARG0]] : !hl.lvalue<si32>
// LL_CF: [[V8:%[0-9]+]] = hl.ref @a : !hl.lvalue<si32>
// LL_CF: [[V9:%[0-9]+]] = hl.implicit_cast [[V8]] LValueToRValue : !hl.lvalue<si32> -> si32
// LL_CF: [[V11:%[0-9]+]] = hl.cmp sgt [[V9]], {{.*}} : si32, si32 -> si32
// LL_CF: [[V12:%[0-9]+]] = hl.implicit_cast [[V11]] IntegralCast : si32 -> i1
// LL_CF: ll.cond_scope_ret [[V12]] : i1, ^bb2
// LL_CF: ^bb2: // 2 preds: ^bb0, ^bb1
// LL_CF: [[V6:%[0-9]+]] = hl.ref [[ARG0]] : !hl.lvalue<si32>
// LL_CF: [[V6:%[0-9]+]] = hl.ref @a : !hl.lvalue<si32>
// LL_CF: {{,*}} = hl.pre.dec [[V6]] : !hl.lvalue<si32> -> si32
// LL_CF: ll.br ^bb1
// LL_CF: }
Expand Down
7 changes: 4 additions & 3 deletions test/vast/Conversion/do-while-b.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// RUN: %check-core-to-llvm %s | %file-check %s -check-prefix=C_LLVM

// LL_CF: ll.func @fn external ([[ARG0:%.*]]: !hl.lvalue<si32>) -> none {
// LL_CF: hl.param @a
// LL_CF: ll.scope {
// LL_CF: [[V3:%[0-9]+]] = ll.initialize {{.*}} : (!hl.lvalue<si32>, si32) -> !hl.lvalue<si32>
// LL_CF: hl.var @sum
// LL_CF: ll.scope {
// LL_CF: ll.br ^bb2
// LL_CF: ^bb1: // pred: ^bb4
Expand All @@ -12,7 +13,7 @@
// LL_CF: [[B1V8:%[0-9]+]] = hl.implicit_cast [[B1V7]] IntegralCast : si32 -> i1
// LL_CF: ll.cond_scope_ret [[B1V8]] : i1, ^bb2
// LL_CF: ^bb2: // 2 preds: ^bb0, ^bb1
// LL_CF: [[V4:%[0-9]+]] = hl.ref [[ARG0]] : !hl.lvalue<si32>
// LL_CF: [[V4:%[0-9]+]] = hl.ref @a : !hl.lvalue<si32>
// LL_CF: [[V5:%[0-9]+]] = hl.implicit_cast [[V4]] LValueToRValue : !hl.lvalue<si32> -> si32
// LL_CF: [[V6:%[0-9]+]] = hl.const #core.integer<42> : si32
// LL_CF: [[V7:%[0-9]+]] = hl.cmp eq [[V5]], [[V6]] : si32, si32 -> si32
Expand All @@ -21,7 +22,7 @@
// LL_CF: ^bb3: // pred: ^bb2
// LL_CF: ll.scope_ret
// LL_CF: ^bb4: // pred: ^bb2
// LL_CF: [[V9:%[0-9]+]] = hl.ref [[V3]] : !hl.lvalue<si32>
// LL_CF: [[V9:%[0-9]+]] = hl.ref @sum : !hl.lvalue<si32>
// LL_CF: [[V10:%[0-9]+]] = hl.post.inc [[V9]] : !hl.lvalue<si32> -> si32
// LL_CF: ll.br ^bb1
// LL_CF: }
Expand Down
6 changes: 5 additions & 1 deletion test/vast/Conversion/empty-a.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@

// No new operations should be emitted since the args are not used.
// CHECK: ll.func {{.*}}
// CHECK-NEXT: %0 = hl.const #void_value
// CHECK-NEXT: ll.cell @arg0
// CHECK-NEXT: ll.cell_init
// CHECK-NEXT: ll.cell @arg1
// CHECK-NEXT: ll.cell_init
// CHECK-NEXT: hl.const #void_value
void empty(int arg0, int arg1) {}
2 changes: 1 addition & 1 deletion test/vast/Conversion/fn-c.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %check-vast-vars-to-cells %s | %file-check %s -check-prefix=CELLS
// RUN: %check-vars-to-cells %s | %file-check %s -check-prefix=CELLS
// RUN: %check-strip-param-lvalues %s | %file-check %s -check-prefix=PARAMS
// RUN: %check-lower-value-categories %s | %file-check %s -check-prefix=VAL_CAT
// RUN: %check-core-to-llvm %s | %file-check %s -check-prefix=C_LLVM
Expand Down
9 changes: 5 additions & 4 deletions test/vast/Conversion/scope-a.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
void fn(int arg)
{
// LL_CF: ll.scope {
// LL_CF: [[V3:%[0-9]+]] = ll.initialize {{.*}} : (!hl.lvalue<si32>, si32) -> !hl.lvalue<si32>
// LL_CF: hl.var @a
// LL_CF: ll.scope {
// LL_CF: ll.cond_br {{.8}} : i1, ^bb1, ^bb2
// LL_CF: ll.cond_br {{.*}} : i1, ^bb1, ^bb2
// LL_CF: ^bb1: // pred: ^bb0
// LL_CF: [[V9:%[0-9]+]] = hl.ref [[V3]] : (!hl.lvalue<si32>) -> !hl.lvalue<si32>
// LL_CF: {{.*}} = hl.assign {{.*}} to [[V9]] : si32, !hl.lvalue<si32> -> si32
// LL_CF: hl.ref @a
// LL_CF: hl.ref @arg
// LL_CF: hl.assign
// LL_CF: ll.br ^bb2
// LL_CF: ^bb2: // 2 preds: ^bb0, ^bb1
// LL_CF: ll.scope_ret
Expand Down
8 changes: 3 additions & 5 deletions test/vast/Conversion/select-c.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ int main(int argc, char** argv)

// C_LLVM: llvm.cond_br {{.*}}, ^bb1, ^bb5
// C_LLVM: ^bb1: // pred: ^bb0
// C_LLVM: {{.*}} = llvm.mlir.constant(3 : i32) : i32
// C_LLVM: llvm.cond_br %13, ^bb2, ^bb3
// C_LLVM: llvm.mlir.constant(3 : i32) : i32
// C_LLVM: llvm.cond_br {{.*}}, ^bb2, ^bb3
// C_LLVM: ^bb2: // pred: ^bb1
// C_LLVM: [[V14:%[0-9]+]] = llvm.mlir.constant(0 : i32) : i32
// C_LLVM: llvm.br ^bb4([[V14]] : i32)
Expand All @@ -43,7 +43,5 @@ int main(int argc, char** argv)
// C_LLVM: ^bb6([[V18:%[0-9]+]]: i32): // 2 preds: ^bb4, ^bb5
// C_LLVM: llvm.return [[V18]] : i32


return (argc >= 3) ? ( ( argc == 3) ? 0 : 1 )
: 2;
return (argc >= 3) ? ((argc == 3) ? 0 : 1) : 2;
}
2 changes: 1 addition & 1 deletion test/vast/Conversion/shift-a.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %vast-front -vast-emit-mlir=llvm %s -o - %s | %file-check %s
// RUN: %vast-front -vast-emit-mlir=llvm %s -o - | %file-check %s

#include <stdint.h>

Expand Down

0 comments on commit 3e9b913

Please sign in to comment.