Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/llvm-intrinsics/sqrt.ll

raw
1 ; RUN: llvm-as < %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv
3 ; RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s
4 ; RUN: spirv-val %t.spv
5
6 ; CHECK: ExtInstImport [[ExtInstSetId:[0-9]+]] "OpenCL.std"
7 ; CHECK: TypeFloat [[Float:[0-9]+]] 32
8 ; CHECK: TypeFloat [[Double:[0-9]+]] 64
9 ; CHECK: TypeVector [[Double4:[0-9]+]] [[Double]] 4
10 ; CHECK: Constant [[Float]] [[FloatArg:[0-9]+]]
11 ; CHECK: Constant [[Double]] [[DoubleArg:[0-9]+]]
12 ; CHECK: ConstantComposite [[Double4]] [[Double4Arg:[0-9]+]]
13
14 target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
15 target triple = "spir"
16
17 ; Function Attrs: noinline nounwind optnone
18 define spir_func void @test_sqrt() #0 {
19 entry:
20 %0 = call float @llvm.sqrt.f32(float 0x40091EB860000000)
21 %1 = call double @llvm.sqrt.f64(double 2.710000e+00)
22 %2 = call <4 x double> @llvm.sqrt.v4f64(<4 x double> <double 5.000000e-01, double 2.000000e-01, double 3.000000e-01, double 4.000000e-01>)
23 %3 = call afn float @llvm.sqrt.f32(float 0x40091EB860000000)
24 %4 = call afn double @llvm.sqrt.f64(double 2.710000e+00)
25 ; CHECK: ExtInst [[Float]] {{[0-9]+}} [[ExtInstSetId]] sqrt [[FloatArg]]
26 ; CHECK: ExtInst [[Double]] {{[0-9]+}} [[ExtInstSetId]] sqrt [[DoubleArg]]
27 ; CHECK: ExtInst [[Double4]] {{[0-9]+}} [[ExtInstSetId]] sqrt [[Double4Arg]]
28 ; CHECK: ExtInst [[Float]] {{[0-9]+}} [[ExtInstSetId]] native_sqrt [[FloatArg]]
29 ; CHECK: ExtInst [[Double]] {{[0-9]+}} [[ExtInstSetId]] sqrt [[DoubleArg]]
30 ret void
31 }
32
33 ; Function Attrs: nounwind readnone speculatable willreturn
34 declare float @llvm.sqrt.f32(float) #1
35
36 ; Function Attrs: nounwind readnone speculatable willreturn
37 declare double @llvm.sqrt.f64(double) #1
38
39 ; Function Attrs: nounwind readnone speculatable willreturn
40 declare <4 x double> @llvm.sqrt.v4f64(<4 x double>) #1
41
42 attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "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"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
43 attributes #1 = { nounwind readnone speculatable willreturn }
44
45 !llvm.module.flags = !{!0}
46 !llvm.ident = !{!1}
47
48 !0 = !{i32 1, !"wchar_size", i32 4}
49 !1 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git b89131cdda5871731a9139664aef2b70c6d72bbd)"}