1// RUN: mlir-translate -mlir-to-cpp %s | FileCheck %s -check-prefix=CPP-DEFAULT 2// RUN: mlir-translate -mlir-to-cpp -declare-variables-at-top %s | FileCheck %s -check-prefix=CPP-DECLTOP 3 4 5func @emitc_constant() { 6 %c0 = "emitc.constant"(){value = #emitc.opaque<""> : i32} : () -> i32 7 %c1 = "emitc.constant"(){value = 42 : i32} : () -> i32 8 %c2 = "emitc.constant"(){value = -1 : i32} : () -> i32 9 %c3 = "emitc.constant"(){value = -1 : si8} : () -> si8 10 %c4 = "emitc.constant"(){value = 255 : ui8} : () -> ui8 11 %c5 = "emitc.constant"(){value = #emitc.opaque<""> : !emitc.opaque<"int32_t*">} : () -> !emitc.opaque<"int32_t*"> 12 %c6 = "emitc.constant"(){value = #emitc.opaque<"NULL"> : !emitc.opaque<"int32_t*">} : () -> !emitc.opaque<"int32_t*"> 13 return 14} 15// CPP-DEFAULT: void emitc_constant() { 16// CPP-DEFAULT-NEXT: int32_t [[V0:[^ ]*]]; 17// CPP-DEFAULT-NEXT: int32_t [[V1:[^ ]*]] = 42; 18// CPP-DEFAULT-NEXT: int32_t [[V2:[^ ]*]] = -1; 19// CPP-DEFAULT-NEXT: int8_t [[V3:[^ ]*]] = -1; 20// CPP-DEFAULT-NEXT: uint8_t [[V4:[^ ]*]] = 255; 21// CPP-DEFAULT-NEXT: int32_t* [[V5:[^ ]*]]; 22// CPP-DEFAULT-NEXT: int32_t* [[V6:[^ ]*]] = NULL; 23 24// CPP-DECLTOP: void emitc_constant() { 25// CPP-DECLTOP-NEXT: int32_t [[V0:[^ ]*]]; 26// CPP-DECLTOP-NEXT: int32_t [[V1:[^ ]*]]; 27// CPP-DECLTOP-NEXT: int32_t [[V2:[^ ]*]]; 28// CPP-DECLTOP-NEXT: int8_t [[V3:[^ ]*]]; 29// CPP-DECLTOP-NEXT: uint8_t [[V4:[^ ]*]]; 30// CPP-DECLTOP-NEXT: int32_t* [[V5:[^ ]*]]; 31// CPP-DECLTOP-NEXT: int32_t* [[V6:[^ ]*]]; 32// CPP-DECLTOP-NEXT: ; 33// CPP-DECLTOP-NEXT: [[V1]] = 42; 34// CPP-DECLTOP-NEXT: [[V2]] = -1; 35// CPP-DECLTOP-NEXT: [[V3]] = -1; 36// CPP-DECLTOP-NEXT: [[V4]] = 255; 37// CPP-DECLTOP-NEXT: ; 38// CPP-DECLTOP-NEXT: [[V6]] = NULL; 39