brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 9c9ea55 Raw
46 lines · plain
1// RUN: mlir-translate -mlir-to-cpp %s | FileCheck %s -check-prefix=CPP-DEFAULT2// RUN: mlir-translate -mlir-to-cpp -declare-variables-at-top %s | FileCheck %s -check-prefix=CPP-DECLTOP3 4 5emitc.func @emitc_func(%arg0 : i32) {6  emitc.call_opaque "foo" (%arg0) : (i32) -> ()7  emitc.return8}9// CPP-DEFAULT: void emitc_func(int32_t [[V0:[^ ]*]]) {10// CPP-DEFAULT-NEXT: foo([[V0:[^ ]*]]);11// CPP-DEFAULT-NEXT: return;12 13 14emitc.func @return_i32() -> i32 attributes {specifiers = ["static","inline"]} {15  %0 = emitc.call_opaque "foo" (): () -> i3216  emitc.return %0 : i3217}18// CPP-DEFAULT: static inline int32_t return_i32() {19// CPP-DEFAULT-NEXT: [[V0:[^ ]*]] = foo();20// CPP-DEFAULT-NEXT: return [[V0:[^ ]*]];21 22// CPP-DECLTOP: static inline int32_t return_i32() {23// CPP-DECLTOP-NEXT: int32_t [[V0:[^ ]*]];24// CPP-DECLTOP-NEXT: [[V0:]] = foo();25// CPP-DECLTOP-NEXT: return [[V0:[^ ]*]];26 27 28emitc.func @emitc_call() -> i32 {29  %0 = emitc.call @return_i32() : () -> (i32)30  emitc.return %0 : i3231}32// CPP-DEFAULT: int32_t emitc_call() {33// CPP-DEFAULT-NEXT: int32_t [[V0:[^ ]*]] = return_i32();34// CPP-DEFAULT-NEXT: return [[V0:[^ ]*]];35 36// CPP-DECLTOP: int32_t emitc_call() {37// CPP-DECLTOP-NEXT: int32_t [[V0:[^ ]*]];38// CPP-DECLTOP-NEXT: [[V0:[^ ]*]] = return_i32();39// CPP-DECLTOP-NEXT: return [[V0:[^ ]*]];40 41emitc.func private @extern_func(i32) attributes {specifiers = ["extern"]}42// CPP-DEFAULT: extern void extern_func(int32_t);43 44emitc.func private @array_arg(!emitc.array<3xi32>) attributes {specifiers = ["extern"]}45// CPP-DEFAULT: extern void array_arg(int32_t[3]);46