xref: /llvm-project/llvm/test/CodeGen/SPIRV/constant/local-float-point-constants.ll (revision 67d3ef74b31e1517d4f679e754cc2b3041c95901)
1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
2
3define half @getConstantFP16() {
4  ret half 0x3ff1340000000000 ; 0x3c4d represented as double.
5}
6
7define float @getConstantFP32() {
8  ret float 0x3fd27c8be0000000 ; 0x3e93e45f represented as double
9}
10
11define double @getConstantFP64() {
12  ret double 0x4f2de42b8c68f3f1
13}
14
15;; Capabilities
16; CHECK-DAG: OpCapability Float16
17; CHECK-DAG: OpCapability Float64
18
19; CHECK-NOT: DAG-FENCE
20
21;; Names:
22; CHECK-DAG: OpName %[[#GET_FP16:]] "getConstantFP16"
23; CHECK-DAG: OpName %[[#GET_FP32:]] "getConstantFP32"
24; CHECK-DAG: OpName %[[#GET_FP64:]] "getConstantFP64"
25
26; CHECK-NOT: DAG-FENCE
27
28;; Types and Constants:
29;; NOTE: These tests don't actually check the values of the constants because
30;;       their representation isn't defined for textual output.
31;; TODO: Test constant representation using binary output.
32; CHECK-DAG: %[[#FP16:]] = OpTypeFloat 16
33; CHECK-DAG: %[[#FP32:]] = OpTypeFloat 32
34; CHECK-DAG: %[[#FP64:]] = OpTypeFloat 64
35; CHECK-DAG: %[[#CST_FP16:]] = OpConstant %[[#FP16]]
36; CHECK-DAG: %[[#CST_FP32:]] = OpConstant %[[#FP32]]
37; CHECK-DAG: %[[#CST_FP64:]] = OpConstant %[[#FP64]]
38
39; CHECK: %[[#GET_FP16]] = OpFunction %[[#FP16]]
40; CHECK: OpReturnValue %[[#CST_FP16]]
41; CHECK: OpFunctionEnd
42
43; CHECK: %[[#GET_FP32]] = OpFunction %[[#FP32]]
44; CHECK: OpReturnValue %[[#CST_FP32]]
45; CHECK: OpFunctionEnd
46
47; CHECK: %[[#GET_FP64]] = OpFunction %[[#FP64]]
48; CHECK: OpReturnValue %[[#CST_FP64]]
49; CHECK: OpFunctionEnd
50