Skip to content

Commit d7de21f

Browse files
[CIR][CIRGen] Removed extra space in "cir.shift( right)" (#997) (#1009)
The MLIR docs at https://mlir.llvm.org/docs/DefiningDialects/Operations/#literals specify that "An empty literal `` may be used to remove a space that is inserted implicitly after certain literal elements", so I inserted one before the `right` literal to remove the extra space that was being printed. Oddly, the bug is also fixed by inserting an empty literal _after_ the `left` literal, which leads me to believe that tablegen is inserting an implicit space after the `left` literal.
1 parent 74d8fe9 commit d7de21f

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ def ShiftOp : CIR_Op<"shift", [Pure]> {
11991199

12001200
let assemblyFormat = [{
12011201
`(`
1202-
(`left` $isShiftleft^) : (`right`)?
1202+
(`left` $isShiftleft^) : (```right`)?
12031203
`,` $value `:` type($value)
12041204
`,` $amount `:` type($amount)
12051205
`)` `->` type($result) attr-dict

clang/test/CIR/CodeGen/binassign.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int foo(int a, int b) {
3434
// CHECK: = cir.binop(sub,
3535
// CHECK: cir.store {{.*}}[[Value]]
3636
// CHECK: = cir.load {{.*}}[[Value]]
37-
// CHECK: = cir.shift( right
37+
// CHECK: = cir.shift(right
3838
// CHECK: cir.store {{.*}}[[Value]]
3939
// CHECK: = cir.load {{.*}}[[Value]]
4040
// CHECK: = cir.shift(left

clang/test/CIR/CodeGen/binop.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void b0(int a, int b) {
1919
// CHECK: = cir.binop(rem, %9, %10) : !s32i
2020
// CHECK: = cir.binop(add, %12, %13) nsw : !s32i
2121
// CHECK: = cir.binop(sub, %15, %16) nsw : !s32i
22-
// CHECK: = cir.shift( right, %18 : !s32i, %19 : !s32i) -> !s32i
22+
// CHECK: = cir.shift(right, %18 : !s32i, %19 : !s32i) -> !s32i
2323
// CHECK: = cir.shift(left, %21 : !s32i, %22 : !s32i) -> !s32i
2424
// CHECK: = cir.binop(and, %24, %25) : !s32i
2525
// CHECK: = cir.binop(xor, %27, %28) : !s32i

clang/test/CIR/CodeGen/vectype.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ void vector_int_test(int x, unsigned short usx) {
108108
// CHECK: %{{[0-9]+}} = cir.shift(left, {{%.*}} : !cir.vector<!s32i x 4>,
109109
// CHECK-SAME: {{%.*}} : !cir.vector<!s32i x 4>) -> !cir.vector<!s32i x 4>
110110
vi4 y = a >> b;
111-
// CHECK: %{{[0-9]+}} = cir.shift( right, {{%.*}} : !cir.vector<!s32i x 4>,
111+
// CHECK: %{{[0-9]+}} = cir.shift(right, {{%.*}} : !cir.vector<!s32i x 4>,
112112
// CHECK-SAME: {{%.*}} : !cir.vector<!s32i x 4>) -> !cir.vector<!s32i x 4>
113113

114114
vus2 z = { usx, usx };
115115
// CHECK: %{{[0-9]+}} = cir.vec.create(%{{[0-9]+}}, %{{[0-9]+}} : !u16i, !u16i) : !cir.vector<!u16i x 2>
116116
vus2 zamt = { 3, 4 };
117117
// CHECK: %{{[0-9]+}} = cir.const #cir.const_vector<[#cir.int<3> : !u16i, #cir.int<4> : !u16i]> : !cir.vector<!u16i x 2>
118118
vus2 zzz = z >> zamt;
119-
// CHECK: %{{[0-9]+}} = cir.shift( right, {{%.*}} : !cir.vector<!u16i x 2>,
119+
// CHECK: %{{[0-9]+}} = cir.shift(right, {{%.*}} : !cir.vector<!u16i x 2>,
120120
// CHECK-SAME: {{%.*}} : !cir.vector<!u16i x 2>) -> !cir.vector<!u16i x 2>
121121
}
122122

0 commit comments

Comments
 (0)