xref: /llvm-project/mlir/test/Target/Cpp/literal.mlir (revision 6c59f0e1b0fb56c909ad7c9aad4bde37dc006ae0)
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
4func.func @emitc_literal(%arg0: f32) {
5  %p0 = emitc.literal "M_PI" : f32
6  %1 = "emitc.add" (%arg0, %p0) : (f32, f32) -> f32
7  return
8}
9// CPP-DEFAULT: void emitc_literal(float [[V0:[^ ]*]]) {
10// CPP-DEFAULT: float [[V2:[^ ]*]] = [[V0:[^ ]*]] + M_PI
11
12// CPP-DECLTOP: void emitc_literal(float [[V0:[^ ]*]]) {
13// CPP-DECLTOP: float [[V1:[^ ]*]];
14// CPP-DECLTOP: [[V1]] = [[V0:[^ ]*]] + M_PI
15