Debian Codegraph @

llvm/test/CodeGen/SPIRV/llvm-intrinsics/llround.ll

raw
1 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3
4 ; CHECK: [[opencl:%[0-9]+]] = OpExtInstImport "OpenCL.std"
5 ; CHECK-DAG: [[f32:%[0-9]+]] = OpTypeFloat 32
6 ; CHECK-DAG: [[i32:%[0-9]+]] = OpTypeInt 32 0
7 ; CHECK-DAG: [[f64:%[0-9]+]] = OpTypeFloat 64
8 ; CHECK-DAG: [[i64:%[0-9]+]] = OpTypeInt 64 0
9 ; CHECK-DAG: [[vecf32:%[0-9]+]] = OpTypeVector [[f32]]
10 ; CHECK-DAG: [[veci32:%[0-9]+]] = OpTypeVector [[i32]]
11 ; CHECK-DAG: [[vecf64:%[0-9]+]] = OpTypeVector [[f64]]
12 ; CHECK-DAG: [[veci64:%[0-9]+]] = OpTypeVector [[i64]]
13
14 ; CHECK: [[rounded_i32_f32:%[0-9]+]] = OpExtInst [[f32]] [[opencl]] round %[[#]]
15 ; CHECK-NEXT: %[[#]] = OpConvertFToS [[i32]] [[rounded_i32_f32]]
16 ; CHECK: [[rounded_i32_f64:%[0-9]+]] = OpExtInst [[f64]] [[opencl]] round %[[#]]
17 ; CHECK-NEXT: %[[#]] = OpConvertFToS [[i32]] [[rounded_i32_f64]]
18 ; CHECK: [[rounded_i64_f32:%[0-9]+]] = OpExtInst [[f32]] [[opencl]] round %[[#]]
19 ; CHECK-NEXT: %[[#]] = OpConvertFToS [[i64]] [[rounded_i64_f32]]
20 ; CHECK: [[rounded_i64_f64:%[0-9]+]] = OpExtInst [[f64]] [[opencl]] round %[[#]]
21 ; CHECK-NEXT: %[[#]] = OpConvertFToS [[i64]] [[rounded_i64_f64]]
22 ; CHECK: [[rounded_v4i32_f32:%[0-9]+]] = OpExtInst [[vecf32]] [[opencl]] round %[[#]]
23 ; CHECK-NEXT: %[[#]] = OpConvertFToS [[veci32]] [[rounded_v4i32_f32]]
24 ; CHECK: [[rounded_v4i32_f64:%[0-9]+]] = OpExtInst [[vecf64]] [[opencl]] round %[[#]]
25 ; CHECK-NEXT: %[[#]] = OpConvertFToS [[veci32]] [[rounded_v4i32_f64]]
26 ; CHECK: [[rounded_v4i64_f32:%[0-9]+]] = OpExtInst [[vecf32]] [[opencl]] round %[[#]]
27 ; CHECK-NEXT: %[[#]] = OpConvertFToS [[veci64]] [[rounded_v4i64_f32]]
28 ; CHECK: [[rounded_v4i64_f64:%[0-9]+]] = OpExtInst [[vecf64]] [[opencl]] round %[[#]]
29 ; CHECK-NEXT: %[[#]] = OpConvertFToS [[veci64]] [[rounded_v4i64_f64]]
30
31 define spir_func i32 @test_llround_i32_f32(float %arg0) {
32 entry:
33 %0 = call i32 @llvm.llround.i32.f32(float %arg0)
34 ret i32 %0
35 }
36
37 define spir_func i32 @test_llround_i32_f64(double %arg0) {
38 entry:
39 %0 = call i32 @llvm.llround.i32.f64(double %arg0)
40 ret i32 %0
41 }
42
43 define spir_func i64 @test_llround_i64_f32(float %arg0) {
44 entry:
45 %0 = call i64 @llvm.llround.i64.f32(float %arg0)
46 ret i64 %0
47 }
48
49 define spir_func i64 @test_llround_i64_f64(double %arg0) {
50 entry:
51 %0 = call i64 @llvm.llround.i64.f64(double %arg0)
52 ret i64 %0
53 }
54
55 define spir_func <4 x i32> @test_llround_v4i32_f32(<4 x float> %arg0) {
56 entry:
57 %0 = call <4 x i32> @llvm.llround.v4i32.f32(<4 x float> %arg0)
58 ret <4 x i32> %0
59 }
60
61 define spir_func <4 x i32> @test_llround_v4i32_f64(<4 x double> %arg0) {
62 entry:
63 %0 = call <4 x i32> @llvm.llround.v4i32.f64(<4 x double> %arg0)
64 ret <4 x i32> %0
65 }
66
67 define spir_func <4 x i64> @test_llround_v4i64_f32(<4 x float> %arg0) {
68 entry:
69 %0 = call <4 x i64> @llvm.llround.v4i64.f32(<4 x float> %arg0)
70 ret <4 x i64> %0
71 }
72
73 define spir_func <4 x i64> @test_llround_v4i64_f64(<4 x double> %arg0) {
74 entry:
75 %0 = call <4 x i64> @llvm.llround.v4i64.f64(<4 x double> %arg0)
76 ret <4 x i64> %0
77 }
78
79 declare i32 @llvm.llround.i32.f32(float)
80 declare i32 @llvm.llround.i32.f64(double)
81 declare i64 @llvm.llround.i64.f32(float)
82 declare i64 @llvm.llround.i64.f64(double)
83
84 declare <4 x i32> @llvm.llround.v4i32.f32(<4 x float>)
85 declare <4 x i32> @llvm.llround.v4i32.f64(<4 x double>)
86 declare <4 x i64> @llvm.llround.v4i64.f32(<4 x float>)
87 declare <4 x i64> @llvm.llround.v4i64.f64(<4 x double>)