Skip to content

Commit 1c50036

Browse files
committed
Fix arg exts for tests
1 parent f14e1a8 commit 1c50036

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

mlir/test/CAPI/execution_engine.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ void testSimpleExecution(void) {
5555
ctx, mlirStringRefCreateFromCString(
5656
// clang-format off
5757
"module { \n"
58+
#ifdef __s390__
59+
" func.func @add(%arg0 : i32) -> (i32 {llvm.signext}) attributes { llvm.emit_c_interface } { \n"
60+
#else
5861
" func.func @add(%arg0 : i32) -> i32 attributes { llvm.emit_c_interface } { \n"
62+
#endif
5963
" %res = arith.addi %arg0, %arg0 : i32 \n"
6064
" return %res : i32 \n"
6165
" } \n"

mlir/test/mlir-cpu-runner/simple.mlir

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
// RUN: mlir-cpu-runner %s | FileCheck %s
2-
// RUN: mlir-cpu-runner %s -e foo | FileCheck -check-prefix=NOMAIN %s
3-
// RUN: mlir-cpu-runner %s --entry-point-result=i32 -e int32_main | FileCheck -check-prefix=INT32MAIN %s
4-
// RUN: mlir-cpu-runner %s --entry-point-result=i64 -e int64_main | FileCheck -check-prefix=INT64MAIN %s
5-
// RUN: mlir-cpu-runner %s -O3 | FileCheck %s
1+
// RUN: mlir-cpu-runner %s -argext-abi-check=false | FileCheck %s
2+
// RUN: mlir-cpu-runner %s -e foo -argext-abi-check=false | FileCheck -check-prefix=NOMAIN %s
3+
// RUN: mlir-cpu-runner %s --entry-point-result=i32 -e int32_main -argext-abi-check=false | FileCheck -check-prefix=INT32MAIN %s
4+
// RUN: mlir-cpu-runner %s --entry-point-result=i64 -e int64_main -argext-abi-check=false | FileCheck -check-prefix=INT64MAIN %s
5+
// RUN: mlir-cpu-runner %s -O3 -argext-abi-check=false | FileCheck %s
66

77
// RUN: cp %s %t
8-
// RUN: mlir-cpu-runner %t -dump-object-file | FileCheck %t
8+
// RUN: mlir-cpu-runner %t -dump-object-file -argext-abi-check=false | FileCheck %t
99
// RUN: ls %t.o
1010
// RUN: rm %t.o
1111

12-
// RUN: mlir-cpu-runner %s -dump-object-file -object-filename=%T/test.o | FileCheck %s
12+
// RUN: mlir-cpu-runner %s -dump-object-file -object-filename=%T/test.o -argext-abi-check=false | FileCheck %s
1313
// RUN: ls %T/test.o
1414
// RUN: rm %T/test.o
1515

mlir/unittests/ExecutionEngine/Invoke.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,21 @@ static LogicalResult lowerToLLVMDialect(ModuleOp module) {
6161
}
6262

6363
TEST(MLIRExecutionEngine, SKIP_WITHOUT_JIT(AddInteger)) {
64+
#ifdef __s390__
65+
std::string moduleStr = R"mlir(
66+
func.func @foo(%arg0 : i32 {llvm.signext}) -> (i32 {llvm.signext}) attributes { llvm.emit_c_interface } {
67+
%res = arith.addi %arg0, %arg0 : i32
68+
return %res : i32
69+
}
70+
)mlir";
71+
#else
6472
std::string moduleStr = R"mlir(
6573
func.func @foo(%arg0 : i32) -> i32 attributes { llvm.emit_c_interface } {
6674
%res = arith.addi %arg0, %arg0 : i32
6775
return %res : i32
6876
}
6977
)mlir";
78+
#endif
7079
DialectRegistry registry;
7180
registerAllDialects(registry);
7281
registerBuiltinDialectTranslation(registry);
@@ -259,6 +268,16 @@ TEST(NativeMemRefJit, MAYBE_JITCallback) {
259268
for (float &elt : *a)
260269
elt = count++;
261270

271+
#ifdef __s390__
272+
std::string moduleStr = R"mlir(
273+
func.func private @callback(%arg0: memref<?x?xf32>, %coefficient: i32 {llvm.signext}) attributes { llvm.emit_c_interface }
274+
func.func @caller_for_callback(%arg0: memref<?x?xf32>, %coefficient: i32 {llvm.signext}) attributes { llvm.emit_c_interface } {
275+
%unranked = memref.cast %arg0: memref<?x?xf32> to memref<*xf32>
276+
call @callback(%arg0, %coefficient) : (memref<?x?xf32>, i32) -> ()
277+
return
278+
}
279+
)mlir";
280+
#else
262281
std::string moduleStr = R"mlir(
263282
func.func private @callback(%arg0: memref<?x?xf32>, %coefficient: i32) attributes { llvm.emit_c_interface }
264283
func.func @caller_for_callback(%arg0: memref<?x?xf32>, %coefficient: i32) attributes { llvm.emit_c_interface } {
@@ -267,6 +286,8 @@ TEST(NativeMemRefJit, MAYBE_JITCallback) {
267286
return
268287
}
269288
)mlir";
289+
#endif
290+
270291
DialectRegistry registry;
271292
registerAllDialects(registry);
272293
registerBuiltinDialectTranslation(registry);

0 commit comments

Comments
 (0)