|
1 | 1 | ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - | FileCheck %s
|
2 | 2 | ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-unknown %s -o - -filetype=obj | spirv-val %}
|
3 | 3 |
|
4 |
| -; Test lowering to spir-v backend |
| 4 | +; Test lowering to spir-v backend for various types and scalar/vector |
5 | 5 |
|
6 |
| -; CHECK-DAG: %[[#uint:]] = OpTypeInt 32 0 |
7 |
| -; CHECK-DAG: %[[#scope:]] = OpConstant %[[#uint]] 3 |
8 | 6 | ; CHECK-DAG: %[[#f32:]] = OpTypeFloat 32
|
| 7 | +; CHECK-DAG: %[[#uint:]] = OpTypeInt 32 0 |
9 | 8 | ; CHECK-DAG: %[[#bool:]] = OpTypeBool
|
10 | 9 | ; CHECK-DAG: %[[#v4_bool:]] = OpTypeVector %[[#bool]] 4
|
11 |
| -; CHECK-DAG: %[[#fexpr:]] = OpFunctionParameter %[[#f32]] |
12 |
| -; CHECK-DAG: %[[#iexpr:]] = OpFunctionParameter %[[#uint]] |
13 |
| -; CHECK-DAG: %[[#idx:]] = OpFunctionParameter %[[#uint]] |
14 |
| -; CHECK-DAG: %[[#vbexpr:]] = OpFunctionParameter %[[#v4_bool]] |
| 10 | +; CHECK-DAG: %[[#scope:]] = OpConstant %[[#uint]] 3 |
15 | 11 |
|
16 |
| -define spir_func void @test_1(float %fexpr, i32 %iexpr, <4 x i1> %vbexpr, i32 %idx) { |
| 12 | +; CHECK: %[[#fexpr:]] = OpFunctionParameter %[[#f32]] |
| 13 | +; CHECK: %[[#idx1:]] = OpFunctionParameter %[[#uint]] |
| 14 | +define float @test_1(float %fexpr, i32 %idx) { |
17 | 15 | entry:
|
18 |
| -; CHECK: %[[#fret:]] = OpGroupNonUniformShuffle %[[#f32]] %[[#fexpr]] %[[#idx]] %[[#scope]] |
| 16 | +; CHECK: %[[#fret:]] = OpGroupNonUniformShuffle %[[#f32]] %[[#fexpr]] %[[#idx1]] %[[#scope]] |
19 | 17 | %0 = call float @llvm.spv.waveReadLaneAt.f32(float %fexpr, i32 %idx)
|
20 |
| -; CHECK: %[[#iret:]] = OpGroupNonUniformShuffle %[[#uint]] %[[#iexpr]] %[[#idx]] %[[#scope]] |
21 |
| - %1 = call i32 @llvm.spv.waveReadLaneAt.i32(i32 %iexpr, i32 %idx) |
22 |
| -; CHECK: %[[#vbret:]] = OpGroupNonUniformShuffle %[[#v4_bool]] %[[#vbexpr]] %[[#idx]] %[[#scope]] |
23 |
| - %2 = call <4 x i1> @llvm.spv.waveReadLaneAt.v4i1(<4 x i1> %vbexpr, i32 %idx) |
24 |
| - ret void |
| 18 | + ret float %0 |
| 19 | +} |
| 20 | + |
| 21 | +; CHECK: %[[#iexpr:]] = OpFunctionParameter %[[#uint]] |
| 22 | +; CHECK: %[[#idx2:]] = OpFunctionParameter %[[#uint]] |
| 23 | +define i32 @test_2(i32 %iexpr, i32 %idx) { |
| 24 | +entry: |
| 25 | +; CHECK: %[[#iret:]] = OpGroupNonUniformShuffle %[[#uint]] %[[#iexpr]] %[[#idx2]] %[[#scope]] |
| 26 | + %0 = call i32 @llvm.spv.waveReadLaneAt.i32(i32 %iexpr, i32 %idx) |
| 27 | + ret i32 %0 |
| 28 | +} |
| 29 | + |
| 30 | +; CHECK: %[[#vbexpr:]] = OpFunctionParameter %[[#v4_bool]] |
| 31 | +; CHECK: %[[#idx3:]] = OpFunctionParameter %[[#uint]] |
| 32 | +define <4 x i1> @test_3(<4 x i1> %vbexpr, i32 %idx) { |
| 33 | +entry: |
| 34 | +; CHECK: %[[#vbret:]] = OpGroupNonUniformShuffle %[[#v4_bool]] %[[#vbexpr]] %[[#idx3]] %[[#scope]] |
| 35 | + %0 = call <4 x i1> @llvm.spv.waveReadLaneAt.v4i1(<4 x i1> %vbexpr, i32 %idx) |
| 36 | + ret <4 x i1> %0 |
25 | 37 | }
|
26 | 38 |
|
27 | 39 | declare float @llvm.spv.waveReadLaneAt.f32(float, i32)
|
|
0 commit comments