aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/Target/Cpp/types.mlir
blob: 0585b27eb6c2294deb46311308fb75809db5c6b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// RUN: mlir-translate -mlir-to-cpp %s | FileCheck %s

// CHECK-LABEL: void opaque_types() {
func.func @opaque_types() {
  // CHECK-NEXT: f<int>();
  emitc.call_opaque "f"() {template_args = [!emitc<opaque<"int">>]} : () -> ()
  // CHECK-NEXT: f<byte>();
  emitc.call_opaque "f"() {template_args = [!emitc<opaque<"byte">>]} : () -> ()
  // CHECK-NEXT: f<unsigned>();
  emitc.call_opaque "f"() {template_args = [!emitc<opaque<"unsigned">>]} : () -> ()
  // CHECK-NEXT: f<status_t>();
  emitc.call_opaque "f"() {template_args = [!emitc<opaque<"status_t">>]} : () -> ()
  // CHECK-NEXT: f<std::vector<std::string>>();
  emitc.call_opaque "f"() {template_args = [!emitc.opaque<"std::vector<std::string>">]} : () -> ()

  return
}

// CHECK-LABEL: void ptr_types() {
func.func @ptr_types() {
  // CHECK-NEXT: f<int32_t*>();
  emitc.call_opaque "f"() {template_args = [!emitc.ptr<i32>]} : () -> ()
  // CHECK-NEXT: f<int64_t*>();
  emitc.call_opaque "f"() {template_args = [!emitc.ptr<i64>]} : () -> ()
  // CHECK-NEXT: f<float*>();
  emitc.call_opaque "f"() {template_args = [!emitc.ptr<f32>]} : () -> ()
  // CHECK-NEXT: f<double*>();
  emitc.call_opaque "f"() {template_args = [!emitc.ptr<f64>]} : () -> ()
  // CHECK-NEXT: int32_t* [[V0:[^ ]*]] = f();
  %0 = emitc.call_opaque "f"() : () -> (!emitc.ptr<i32>)
  // CHECK-NEXT: int32_t** [[V1:[^ ]*]] = f([[V0:[^ ]*]]);
  %1 = emitc.call_opaque "f"(%0) : (!emitc.ptr<i32>) -> (!emitc.ptr<!emitc.ptr<i32>>)
  // CHECK-NEXT: f<int*>();
  emitc.call_opaque "f"() {template_args = [!emitc.ptr<!emitc.opaque<"int">>]} : () -> ()

  return
}