88 lines · plain
1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s2; 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 326; CHECK-DAG: [[i32:%[0-9]+]] = OpTypeInt 32 07; CHECK-DAG: [[f64:%[0-9]+]] = OpTypeFloat 648; CHECK-DAG: [[i64:%[0-9]+]] = OpTypeInt 64 09; 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 31define spir_func i32 @test_llround_i32_f32(float %arg0) {32entry:33 %0 = call i32 @llvm.llround.i32.f32(float %arg0)34 ret i32 %035}36 37define spir_func i32 @test_llround_i32_f64(double %arg0) {38entry:39 %0 = call i32 @llvm.llround.i32.f64(double %arg0)40 ret i32 %041}42 43define spir_func i64 @test_llround_i64_f32(float %arg0) {44entry:45 %0 = call i64 @llvm.llround.i64.f32(float %arg0)46 ret i64 %047}48 49define spir_func i64 @test_llround_i64_f64(double %arg0) {50entry:51 %0 = call i64 @llvm.llround.i64.f64(double %arg0)52 ret i64 %053}54 55define spir_func <4 x i32> @test_llround_v4i32_f32(<4 x float> %arg0) {56entry:57 %0 = call <4 x i32> @llvm.llround.v4i32.f32(<4 x float> %arg0)58 ret <4 x i32> %059}60 61define spir_func <4 x i32> @test_llround_v4i32_f64(<4 x double> %arg0) {62entry:63 %0 = call <4 x i32> @llvm.llround.v4i32.f64(<4 x double> %arg0)64 ret <4 x i32> %065}66 67define spir_func <4 x i64> @test_llround_v4i64_f32(<4 x float> %arg0) {68entry:69 %0 = call <4 x i64> @llvm.llround.v4i64.f32(<4 x float> %arg0)70 ret <4 x i64> %071}72 73define spir_func <4 x i64> @test_llround_v4i64_f64(<4 x double> %arg0) {74entry:75 %0 = call <4 x i64> @llvm.llround.v4i64.f64(<4 x double> %arg0)76 ret <4 x i64> %077}78 79declare i32 @llvm.llround.i32.f32(float)80declare i32 @llvm.llround.i32.f64(double)81declare i64 @llvm.llround.i64.f32(float)82declare i64 @llvm.llround.i64.f64(double)83 84declare <4 x i32> @llvm.llround.v4i32.f32(<4 x float>)85declare <4 x i32> @llvm.llround.v4i32.f64(<4 x double>)86declare <4 x i64> @llvm.llround.v4i64.f32(<4 x float>)87declare <4 x i64> @llvm.llround.v4i64.f64(<4 x double>)88