brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · 2a5ff1a Raw
74 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 4func.func @emitc_constant() {5  %c0 = "emitc.constant"(){value = #emitc.opaque<"INT_MAX">} : () -> i326  %c1 = "emitc.constant"(){value = 42 : i32} : () -> i327  %c2 = "emitc.constant"(){value = -1 : i32} : () -> i328  %c3 = "emitc.constant"(){value = -1 : si8} : () -> si89  %c4 = "emitc.constant"(){value = 255 : ui8} : () -> ui810  %c5 = "emitc.constant"(){value = #emitc.opaque<"CHAR_MIN">} : () -> !emitc.opaque<"char">11  %c6 = "emitc.constant"(){value = 2 : index} : () -> index12  %c7 = "emitc.constant"(){value = 2.0 : f32} : () -> f3213  %f64 = "emitc.constant"(){value = 4.0 : f64} : () -> f6414  %f16 = "emitc.constant"(){value = 2.0 : f16} : () -> f1615  %bf16 = "emitc.constant"(){value = 4.0 : bf16} : () -> bf1616  %c8 = "emitc.constant"(){value = dense<0> : tensor<i32>} : () -> tensor<i32>17  %c9 = "emitc.constant"(){value = dense<[0, 1]> : tensor<2xindex>} : () -> tensor<2xindex>18  %c10 = "emitc.constant"(){value = dense<[[0.0, 1.0], [2.0, 3.0]]> : tensor<2x2xf32>} : () -> tensor<2x2xf32>19  %c11 = "emitc.constant"(){value = dense<[0, 1]> : !emitc.array<2xindex>} : () -> !emitc.array<2xindex>20  %c12 = "emitc.constant"(){value = dense<[0.0, 1.0]> : !emitc.array<2xf32>} : () -> !emitc.array<2xf32>21  return22}23// CPP-DEFAULT: void emitc_constant() {24// CPP-DEFAULT-NEXT: int32_t [[V0:[^ ]*]] = INT_MAX;25// CPP-DEFAULT-NEXT: int32_t [[V1:[^ ]*]] = 42;26// CPP-DEFAULT-NEXT: int32_t [[V2:[^ ]*]] = -1;27// CPP-DEFAULT-NEXT: int8_t [[V3:[^ ]*]] = -1;28// CPP-DEFAULT-NEXT: uint8_t [[V4:[^ ]*]] = 255;29// CPP-DEFAULT-NEXT: char [[V5:[^ ]*]] = CHAR_MIN;30// CPP-DEFAULT-NEXT: size_t [[V6:[^ ]*]] = 2;31// CPP-DEFAULT-NEXT: float [[V7:[^ ]*]] = 2.000000000e+00f;32// CPP-DEFAULT-NEXT: double [[F64:[^ ]*]] = 4.00000000000000000e+00;33// CPP-DEFAULT-NEXT: _Float16 [[F16:[^ ]*]] = 2.00000e+00f16;34// CPP-DEFAULT-NEXT: __bf16 [[BF16:[^ ]*]] = 4.0000e+00bf16;35// CPP-DEFAULT-NEXT: Tensor<int32_t> [[V8:[^ ]*]] = {0};36// CPP-DEFAULT-NEXT: Tensor<size_t, 2> [[V9:[^ ]*]] = {0, 1};37// CPP-DEFAULT-NEXT: Tensor<float, 2, 2> [[V10:[^ ]*]] = {0.0e+00f, 1.000000000e+00f, 2.000000000e+00f, 3.000000000e+00f};38// CPP-DEFAULT-NEXT: size_t [[V11:[^ ]*]][2] = {0, 1};39// CPP-DEFAULT-NEXT: float [[V12:[^ ]*]][2] = {0.0e+00f, 1.000000000e+00f};40 41// CPP-DECLTOP: void emitc_constant() {42// CPP-DECLTOP-NEXT: int32_t [[V0:[^ ]*]];43// CPP-DECLTOP-NEXT: int32_t [[V1:[^ ]*]];44// CPP-DECLTOP-NEXT: int32_t [[V2:[^ ]*]];45// CPP-DECLTOP-NEXT: int8_t [[V3:[^ ]*]];46// CPP-DECLTOP-NEXT: uint8_t [[V4:[^ ]*]];47// CPP-DECLTOP-NEXT: char [[V5:[^ ]*]];48// CPP-DECLTOP-NEXT: size_t [[V6:[^ ]*]];49// CPP-DECLTOP-NEXT: float [[V7:[^ ]*]];50// CPP-DECLTOP-NEXT: double [[F64:[^ ]*]];51// CPP-DECLTOP-NEXT: _Float16 [[F16:[^ ]*]];52// CPP-DECLTOP-NEXT: __bf16 [[BF16:[^ ]*]];53// CPP-DECLTOP-NEXT: Tensor<int32_t> [[V8:[^ ]*]];54// CPP-DECLTOP-NEXT: Tensor<size_t, 2> [[V9:[^ ]*]];55// CPP-DECLTOP-NEXT: Tensor<float, 2, 2> [[V10:[^ ]*]];56// CPP-DECLTOP-NEXT: size_t [[V11:[^ ]*]][2];57// CPP-DECLTOP-NEXT: float [[V12:[^ ]*]][2];58// CPP-DECLTOP-NEXT: [[V0]] = INT_MAX;59// CPP-DECLTOP-NEXT: [[V1]] = 42;60// CPP-DECLTOP-NEXT: [[V2]] = -1;61// CPP-DECLTOP-NEXT: [[V3]] = -1;62// CPP-DECLTOP-NEXT: [[V4]] = 255;63// CPP-DECLTOP-NEXT: [[V5]] = CHAR_MIN;64// CPP-DECLTOP-NEXT: [[V6]] = 2;65// CPP-DECLTOP-NEXT: [[V7]] = 2.000000000e+00f;66// CPP-DECLTOP-NEXT: [[F64]] = 4.00000000000000000e+00;67// CPP-DECLTOP-NEXT: [[F16]] = 2.00000e+00f16;68// CPP-DECLTOP-NEXT: [[BF16]] = 4.0000e+00bf16;69// CPP-DECLTOP-NEXT: [[V8]] = {0};70// CPP-DECLTOP-NEXT: [[V9]] = {0, 1};71// CPP-DECLTOP-NEXT: [[V10]] = {0.0e+00f, 1.000000000e+00f, 2.000000000e+00f, 3.000000000e+00f};72// CPP-DECLTOP-NEXT: [[V11]] = {0, 1};73// CPP-DECLTOP-NEXT: [[V12]] = {0.0e+00f, 1.000000000e+00f};74