File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
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
+ func.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 M_PI;
14
+ // CPP-DECLTOP: float [[V1:[^ ]*]];
15
+ // CPP-DECLTOP: [[V1]] = [[V0:[^ ]*]] + M_PI
Original file line number Diff line number Diff line change
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
+ // XFAIL: *
4
+
5
+ func.func @emitc_call_operand () {
6
+ %p0 = emitc.literal " M_PI" : f32
7
+ %1 = emitc.call " foo" (%p0 ) : (f32 ) -> f32
8
+ return
9
+ }
10
+ // CPP-DEFAULT: void emitc_call_operand() {
11
+ // CPP-DEFAULT-NEXT: float v1 = foo(M_PI);
12
+
13
+ // CPP-DECLTOP: void emitc_call_operand() {
14
+ // CPP-DECLTOP-NEXT: float M_PI;
15
+ // CPP-DECLTOP-NEXT: float v1;
16
+ // CPP-DECLTOP-NEXT: v1 = foo(M_PI);
You can’t perform that action at this time.
0 commit comments