xref: /llvm-project/mlir/test/Dialect/SPIRV/IR/asm-op-interface.mlir (revision b41eb9601cf1aa6e33eedbb1c923b8ed0dcdcd42)
1// RUN: mlir-opt %s -split-input-file | FileCheck %s
2
3func.func @const() -> () {
4  // CHECK: %true
5  %0 = spirv.Constant true
6  // CHECK: %false
7  %1 = spirv.Constant false
8
9  // CHECK: %cst42_i32
10  %2 = spirv.Constant 42 : i32
11  // CHECK: %cst-42_i32
12  %-2 = spirv.Constant -42 : i32
13  // CHECK: %cst43_i64
14  %3 = spirv.Constant 43 : i64
15
16  // CHECK-NEXT: %cst6_ui8
17  %9 = spirv.Constant 6 : ui8
18
19  // CHECK: %cst_f32
20  %4 = spirv.Constant 0.5 : f32
21  // CHECK: %cst_f64
22  %5 = spirv.Constant 0.5 : f64
23
24  // CHECK: %cst_vec_3xi32
25  %6 = spirv.Constant dense<[1, 2, 3]> : vector<3xi32>
26
27  // CHECK: %cst
28  %8 = spirv.Constant [dense<3.0> : vector<2xf32>] : !spirv.array<1xvector<2xf32>>
29
30  return
31}
32
33// -----
34
35spirv.module Logical GLSL450 {
36  spirv.GlobalVariable @global_var : !spirv.ptr<f32, Input>
37
38  spirv.func @addressof() -> () "None" {
39    // CHECK: %global_var_addr = spirv.mlir.addressof
40    %0 = spirv.mlir.addressof @global_var : !spirv.ptr<f32, Input>
41    spirv.Return
42  }
43}
44
45