@@ -65,15 +65,15 @@ func.func @do_not_inline(%arg0: i32, %arg1: i32, %arg2 : i32) -> i32 {
65
65
return %e : i32
66
66
}
67
67
68
- // CPP-DEFAULT: float paranthesis_for_low_precedence (int32_t [[VAL_1:v[0-9]+]], int32_t [[VAL_2:v[0-9]+]], int32_t [[VAL_3:v[0-9]+]]) {
68
+ // CPP-DEFAULT: float parentheses_for_low_precedence (int32_t [[VAL_1:v[0-9]+]], int32_t [[VAL_2:v[0-9]+]], int32_t [[VAL_3:v[0-9]+]]) {
69
69
// CPP-DEFAULT-NEXT: return (float) ([[VAL_1]] + [[VAL_2]] * [[VAL_3]]);
70
70
// CPP-DEFAULT-NEXT: }
71
71
72
- // CPP-DECLTOP: float paranthesis_for_low_precedence (int32_t [[VAL_1:v[0-9]+]], int32_t [[VAL_2:v[0-9]+]], int32_t [[VAL_3:v[0-9]+]]) {
72
+ // CPP-DECLTOP: float parentheses_for_low_precedence (int32_t [[VAL_1:v[0-9]+]], int32_t [[VAL_2:v[0-9]+]], int32_t [[VAL_3:v[0-9]+]]) {
73
73
// CPP-DECLTOP-NEXT: return (float) ([[VAL_1]] + [[VAL_2]] * [[VAL_3]]);
74
74
// CPP-DECLTOP-NEXT: }
75
75
76
- func.func @paranthesis_for_low_precedence (%arg0: i32 , %arg1: i32 , %arg2: i32 ) -> f32 {
76
+ func.func @parentheses_for_low_precedence (%arg0: i32 , %arg1: i32 , %arg2: i32 ) -> f32 {
77
77
%e = emitc.expression : f32 {
78
78
%a = emitc.add %arg0 , %arg1 : (i32 , i32 ) -> i32
79
79
%b = emitc.mul %a , %arg2 : (i32 , i32 ) -> i32
@@ -83,6 +83,23 @@ func.func @paranthesis_for_low_precedence(%arg0: i32, %arg1: i32, %arg2: i32) ->
83
83
return %e : f32
84
84
}
85
85
86
+ // CPP-DEFAULT: int32_t parentheses_for_same_precedence(int32_t [[VAL_1:v[0-9]+]], int32_t [[VAL_2:v[0-9]+]], int32_t [[VAL_3:v[0-9]+]]) {
87
+ // CPP-DEFAULT-NEXT: return [[VAL_3]] / ([[VAL_1]] * [[VAL_2]]);
88
+ // CPP-DEFAULT-NEXT: }
89
+
90
+ // CPP-DECLTOP: int32_t parentheses_for_same_precedence(int32_t [[VAL_1:v[0-9]+]], int32_t [[VAL_2:v[0-9]+]], int32_t [[VAL_3:v[0-9]+]]) {
91
+ // CPP-DECLTOP-NEXT: return [[VAL_3]] / ([[VAL_1]] * [[VAL_2]]);
92
+ // CPP-DECLTOP-NEXT: }
93
+ func.func @parentheses_for_same_precedence (%arg0: i32 , %arg1: i32 , %arg2: i32 ) -> i32 {
94
+ %e = emitc.expression : i32 {
95
+ %0 = emitc.mul %arg0 , %arg1 : (i32 , i32 ) -> i32
96
+ %1 = emitc.div %arg2 , %0 : (i32 , i32 ) -> i32
97
+ emitc.yield %1 : i32
98
+ }
99
+
100
+ return %e : i32
101
+ }
102
+
86
103
// CPP-DEFAULT: int32_t multiple_uses(int32_t [[VAL_1:v[0-9]+]], int32_t [[VAL_2:v[0-9]+]], int32_t [[VAL_3:v[0-9]+]], int32_t [[VAL_4:v[0-9]+]]) {
87
104
// CPP-DEFAULT-NEXT: bool [[VAL_5:v[0-9]+]] = bar([[VAL_1]] * [[VAL_2]], [[VAL_3]]) - [[VAL_4]] < [[VAL_2]];
88
105
// CPP-DEFAULT-NEXT: int32_t [[VAL_6:v[0-9]+]];
0 commit comments