Skip to content

Commit 6b2ea18

Browse files
committed
[CIR][Lowering] Fix inconditional sign extension on vec.cmp
1 parent b647f4b commit 6b2ea18

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

clang/test/CIR/Lowering/vec-cmp.cir

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
!s16i = !cir.int<s, 16>
55
!u16i = !cir.int<u, 16>
6+
!u8i = !cir.int<u, 8>
67

78
cir.func @vec_cmp(%0: !cir.vector<!s16i x 16>, %1: !cir.vector<!s16i x 16>) -> () {
89
%2 = cir.vec.cmp(lt, %0, %1) : !cir.vector<!s16i x 16>, !cir.vector<!cir.int<u, 1> x 16>
@@ -14,3 +15,15 @@ cir.func @vec_cmp(%0: !cir.vector<!s16i x 16>, %1: !cir.vector<!s16i x 16>) -> (
1415
// MLIR-NEXT: %{{[0-9]+}} = llvm.icmp "slt" %arg0, %arg1 : vector<16xi16>
1516
// MLIR-NEXT: %{{[0-9]+}} = llvm.bitcast %{{[0-9]+}} : vector<16xi1> to i16
1617
// MLIR-NEXT: llvm.return
18+
19+
cir.func @vec_cmp_zero(%0: !cir.vector<!u8i x 16>) -> () {
20+
%1 = cir.const #cir.zero : !cir.vector<!u8i x 16>
21+
%2 = cir.vec.cmp(lt, %0, %1) : !cir.vector<!u8i x 16>, !cir.vector<!cir.int<u, 1> x 16>
22+
%3 = cir.cast(bitcast, %2 : !cir.vector<!cir.int<u, 1> x 16>), !cir.int<u, 16>
23+
24+
cir.return
25+
}
26+
27+
// MLIR: llvm.func @vec_cmp_zero
28+
// MLIR: %{{[0-9]+}} = llvm.icmp "slt" %arg0, %{{[0-9]+}} : vector<16xi8>
29+
// MLIR-NEXT: %{{[0-9]+}} = llvm.bitcast %{{[0-9]+}} : vector<16xi1> to i16

0 commit comments

Comments
 (0)