| 1 |
; RUN: llvm-as %s -o %t.bc |
| 2 |
; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s |
| 3 |
; RUN: llvm-spirv %t.bc -o %t.spv |
| 4 |
; RUN: spirv-val %t.spv |
| 5 |
|
| 6 |
; CHECK: Name [[sf:[0-9]+]] "conv" |
| 7 |
; CHECK: Name [[uf:[0-9]+]] "conv1" |
| 8 |
; CHECK: Name [[fs:[0-9]+]] "conv2" |
| 9 |
; CHECK: Name [[fu:[0-9]+]] "conv3" |
| 10 |
; CHECK: Name [[fe:[0-9]+]] "conv4" |
| 11 |
; CHECK: Name [[ft:[0-9]+]] "conv5" |
| 12 |
|
| 13 |
; CHECK-DAG: Decorate [[sf]] FPRoundingMode 0 |
| 14 |
; CHECK-DAG: Decorate [[uf]] FPRoundingMode 1 |
| 15 |
; CHECK-DAG: Decorate [[ft]] FPRoundingMode 2 |
| 16 |
|
| 17 |
; CHECK-NOT: Decorate [[fs]] FPRoundingMode |
| 18 |
; CHECK-NOT: Decorate [[fu]] FPRoundingMode |
| 19 |
; CHECK-NOT: Decorate [[fe]] FPRoundingMode |
| 20 |
|
| 21 |
|
| 22 |
;CHECK: ConvertSToF {{[0-9]+}} [[sf]] |
| 23 |
;CHECK: ConvertUToF {{[0-9]+}} [[uf]] |
| 24 |
;CHECK: ConvertFToS {{[0-9]+}} [[fs]] |
| 25 |
;CHECK: ConvertFToU {{[0-9]+}} [[fu]] |
| 26 |
;CHECK: FConvert {{[0-9]+}} [[fe]] |
| 27 |
;CHECK: FConvert {{[0-9]+}} [[ft]] |
| 28 |
|
| 29 |
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" |
| 30 |
target triple = "spir64-unknown-linux" |
| 31 |
|
| 32 |
; Function Attrs: norecurse nounwind strictfp |
| 33 |
define dso_local spir_kernel void @test(float %a, i32 %in, i32 %ui) local_unnamed_addr #0 !kernel_arg_addr_space !5 !kernel_arg_access_qual !6 !kernel_arg_type !7 !kernel_arg_base_type !7 !kernel_arg_type_qual !8 !kernel_arg_buffer_location !9 { |
| 34 |
entry: |
| 35 |
%conv = tail call float @llvm.experimental.constrained.sitofp.f32.i32(i32 %in, metadata !"round.tonearest", metadata !"fpexcept.ignore") #2 |
| 36 |
%conv1 = tail call float @llvm.experimental.constrained.uitofp.f32.i32(i32 %ui, metadata !"round.towardzero", metadata !"fpexcept.ignore") #2 |
| 37 |
%conv2 = tail call i32 @llvm.experimental.constrained.fptosi.i32.f32(float %conv1, metadata !"fpexcept.ignore") #2 |
| 38 |
%conv3 = tail call i32 @llvm.experimental.constrained.fptoui.i32.f32(float %conv1, metadata !"fpexcept.ignore") #2 |
| 39 |
%conv4 = tail call double @llvm.experimental.constrained.fpext.f64.f32(float %conv1, metadata !"fpexcept.ignore") #2 |
| 40 |
%conv5 = tail call float @llvm.experimental.constrained.fptrunc.f32.f64(double %conv4, metadata !"round.upward", metadata !"fpexcept.ignore") #2 |
| 41 |
ret void |
| 42 |
} |
| 43 |
|
| 44 |
; Function Attrs: inaccessiblememonly nounwind willreturn |
| 45 |
declare float @llvm.experimental.constrained.sitofp.f32.i32(i32, metadata, metadata) #1 |
| 46 |
|
| 47 |
; Function Attrs: inaccessiblememonly nounwind willreturn |
| 48 |
declare float @llvm.experimental.constrained.uitofp.f32.i32(i32, metadata, metadata) #1 |
| 49 |
|
| 50 |
; Function Attrs: inaccessiblememonly nounwind willreturn |
| 51 |
declare i32 @llvm.experimental.constrained.fptosi.i32.f32(float, metadata) #1 |
| 52 |
|
| 53 |
; Function Attrs: inaccessiblememonly nounwind willreturn |
| 54 |
declare i32 @llvm.experimental.constrained.fptoui.i32.f32(float, metadata) #1 |
| 55 |
|
| 56 |
; Function Attrs: inaccessiblememonly nounwind willreturn |
| 57 |
declare double @llvm.experimental.constrained.fpext.f64.f32(float, metadata) #1 |
| 58 |
|
| 59 |
; Function Attrs: inaccessiblememonly nounwind willreturn |
| 60 |
declare float @llvm.experimental.constrained.fptrunc.f32.f64(double, metadata, metadata) #1 |
| 61 |
|
| 62 |
attributes #0 = { norecurse nounwind strictfp "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="test2.cl" "uniform-work-group-size"="true" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 63 |
attributes #1 = { inaccessiblememonly nounwind willreturn } |
| 64 |
attributes #2 = { strictfp } |
| 65 |
|
| 66 |
!llvm.module.flags = !{!0} |
| 67 |
!opencl.ocl.version = !{!1} |
| 68 |
!opencl.spir.version = !{!2, !2} |
| 69 |
!spirv.Source = !{!3} |
| 70 |
!llvm.ident = !{!4} |
| 71 |
|
| 72 |
!0 = !{i32 1, !"wchar_size", i32 4} |
| 73 |
!1 = !{i32 1, i32 0} |
| 74 |
!2 = !{i32 1, i32 2} |
| 75 |
!3 = !{i32 4, i32 100000} |
| 76 |
!4 = !{!"clang version 12.0.0 (https://github.com/c199914007/llvm.git f0c85a8adeb49638c01eee1451aa9b35462cbfd5)"} |
| 77 |
!5 = !{i32 0, i32 0, i32 0} |
| 78 |
!6 = !{!"none", !"none", !"none"} |
| 79 |
!7 = !{!"float", !"int", !"uint"} |
| 80 |
!8 = !{!"", !"", !""} |
| 81 |
!9 = !{i32 -1, i32 -1, i32 -1} |