Commit 16b3c16 1 parent be9e374 commit 16b3c16 Copy full SHA for 16b3c16
File tree 2 files changed +48
-0
lines changed
test/vast/Conversion/Common/IRsToLLVM
2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %vast-cc1 -triple x86_64-unknown-linux-gnu -vast-emit-mlir=hl %s -o %t.mlir
2
+ // RUN: %file-check --input-file=%t.mlir %s -check-prefix=HL
3
+ // RUN: %vast-cc1 -triple x86_64-unknown-linux-gnu -vast-emit-mlir=llvm %s -o %t.mlir
4
+ // RUN: %file-check --input-file=%t.mlir %s -check-prefix=MLIR
5
+ // RUN: %vast-cc1 -triple x86_64-unknown-linux-gnu -vast-emit-llvm %s -o %t.ll
6
+ // RUN: %file-check --input-file=%t.ll %s -check-prefix=LLVM
7
+
8
+ void ptr_to_bool () {
9
+ void * p ;
10
+ _Bool b = p ;
11
+ }
12
+
13
+ // HL: hl.func @ptr_to_bool ()
14
+ // HL: hl.implicit_cast {{.*}} PointerToBoolean : !hl.ptr<!hl.void> -> !hl.bool
15
+ // HL: }
16
+
17
+ // MLIR: llvm.func @ptr_to_bool()
18
+ // MLIR: llvm.mlir.null
19
+ // MLIR: llvm.icmp "ne"
20
+ // MLIR: llvm.zext {{.*}} : i1 to i8
21
+ // MLIR: }
22
+
23
+ // LLVM: define void @ptr_to_bool()
24
+ // LLVM: icmp ne ptr {{.*}}, null
25
+ // LLVM: zext i1 {{.*}} to i8
26
+ // LLVM: }
Original file line number Diff line number Diff line change
1
+ // RUN: %vast-cc1 -triple x86_64-unknown-linux-gnu -vast-emit-mlir=hl %s -o %t.mlir
2
+ // RUN: %file-check --input-file=%t.mlir %s -check-prefix=HL
3
+ // RUN: %vast-cc1 -triple x86_64-unknown-linux-gnu -vast-emit-mlir=llvm %s -o %t.mlir
4
+ // RUN: %file-check --input-file=%t.mlir %s -check-prefix=MLIR
5
+ // RUN: %vast-cc1 -triple x86_64-unknown-linux-gnu -vast-emit-llvm %s -o %t.ll
6
+ // RUN: %file-check --input-file=%t.ll %s -check-prefix=LLVM
7
+
8
+ void null_to_ptr () {
9
+ void * p = 0 ;
10
+ }
11
+
12
+ // HL: hl.func @null_to_ptr ()
13
+ // HL: hl.implicit_cast {{.*}} NullToPointer : !hl.int -> !hl.ptr<!hl.void>
14
+ // HL: }
15
+
16
+ // MLIR: llvm.func @null_to_ptr()
17
+ // MLIR: llvm.mlir.null
18
+ // MLIR: }
19
+
20
+ // LLVM: define void @null_to_ptr()
21
+ // LLVM: store ptr null, ptr
22
+ // LLVM: }
You can’t perform that action at this time.
0 commit comments