1 // RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
3 //===----------------------------------------------------------------------===//
5 //===----------------------------------------------------------------------===//
7 // CHECK-LABEL: @bool_constant_scalar
8 spv.func @bool_constant_scalar() "None" {
9 // CHECK: llvm.mlir.constant(true) : i1
10 %0 = spv.Constant true
11 // CHECK: llvm.mlir.constant(false) : i1
12 %1 = spv.Constant false
16 // CHECK-LABEL: @bool_constant_vector
17 spv.func @bool_constant_vector() "None" {
18 // CHECK: llvm.mlir.constant(dense<[true, false]> : vector<2xi1>) : vector<2xi1>
19 %0 = spv.Constant dense<[true, false]> : vector<2xi1>
20 // CHECK: llvm.mlir.constant(dense<false> : vector<3xi1>) : vector<3xi1>
21 %1 = spv.Constant dense<false> : vector<3xi1>
25 // CHECK-LABEL: @integer_constant_scalar
26 spv.func @integer_constant_scalar() "None" {
27 // CHECK: llvm.mlir.constant(0 : i8) : i8
28 %0 = spv.Constant 0 : i8
29 // CHECK: llvm.mlir.constant(-5 : i64) : i64
30 %1 = spv.Constant -5 : si64
31 // CHECK: llvm.mlir.constant(10 : i16) : i16
32 %2 = spv.Constant 10 : ui16
36 // CHECK-LABEL: @integer_constant_vector
37 spv.func @integer_constant_vector() "None" {
38 // CHECK: llvm.mlir.constant(dense<[2, 3]> : vector<2xi32>) : vector<2xi32>
39 %0 = spv.Constant dense<[2, 3]> : vector<2xi32>
40 // CHECK: llvm.mlir.constant(dense<-4> : vector<2xi32>) : vector<2xi32>
41 %1 = spv.Constant dense<-4> : vector<2xsi32>
42 // CHECK: llvm.mlir.constant(dense<[2, 3, 4]> : vector<3xi32>) : vector<3xi32>
43 %2 = spv.Constant dense<[2, 3, 4]> : vector<3xui32>
47 // CHECK-LABEL: @float_constant_scalar
48 spv.func @float_constant_scalar() "None" {
49 // CHECK: llvm.mlir.constant(5.000000e+00 : f16) : f16
50 %0 = spv.Constant 5.000000e+00 : f16
51 // CHECK: llvm.mlir.constant(5.000000e+00 : f64) : f64
52 %1 = spv.Constant 5.000000e+00 : f64
56 // CHECK-LABEL: @float_constant_vector
57 spv.func @float_constant_vector() "None" {
58 // CHECK: llvm.mlir.constant(dense<[2.000000e+00, 3.000000e+00]> : vector<2xf32>) : vector<2xf32>
59 %0 = spv.Constant dense<[2.000000e+00, 3.000000e+00]> : vector<2xf32>