7
7
; SYCL 2020 specialization constant intrinsics for different types in a device
8
8
; code.
9
9
10
- %class.specialization_id = type { double }
10
+ %class.specialization_id = type { half }
11
11
%class.specialization_id.0 = type { i32 }
12
12
%class.specialization_id.1 = type { %struct.ComposConst }
13
13
%struct.ComposConst = type { i32 , double , %struct.myConst }
14
14
%struct.myConst = type { i32 , float }
15
15
%class.specialization_id.2 = type { %struct.ComposConst2 }
16
16
%struct.ComposConst2 = type { i8 , %struct.myConst , double }
17
17
18
- @id_double = dso_local global %class.specialization_id { double 3 .140000e+ 00 }, align 8
18
+ @id_half = dso_local global %class.specialization_id { half 0xH4000 }, align 8
19
19
@id_int = dso_local global %class.specialization_id.0 { i32 42 }, align 4
20
20
@id_compos = dso_local global %class.specialization_id.1 { %struct.ComposConst { i32 1 , double 2 .000000e+00 , %struct.myConst { i32 13 , float 0x4020666660000000 } } }, align 8
21
21
@id_compos2 = dso_local global %class.specialization_id.2 { %struct.ComposConst2 { i8 1 , %struct.myConst { i32 52 , float 0x40479999A0000000 }, double 2 .000000e+00 } }, align 8
24
24
; used in the module anymore, they could still be referenced by debug info
25
25
; metadata (specialization_id objects are used as template arguments in SYCL
26
26
; specialization constant APIs)
27
- ; CHECK: @id_double
27
+ ; CHECK: @id_half
28
28
; CHECK: @id_int
29
29
; CHECK: @id_compos
30
30
; CHECK: @id_compos2
31
31
32
- @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z9id_doubleE17specialization_idIdEdET1_v = private unnamed_addr constant [37 x i8 ] c "_ZTS14name_generatorIL_Z9id_doubleEE \00 " , align 1
32
+ @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z9id_halfE17specialization_idIdEdET1_v = private unnamed_addr constant [35 x i8 ] c "_ZTS14name_generatorIL_Z9id_halfEE \00 " , align 1
33
33
@__builtin_unique_stable_name._Z27get_specialization_constantIL_Z6id_intE17specialization_idIiEiET1_v = private unnamed_addr constant [34 x i8 ] c "_ZTS14name_generatorIL_Z6id_intEE\00 " , align 1
34
34
@__builtin_unique_stable_name._Z27get_specialization_constantIL_Z9id_composE17specialization_idI11ComposConstES1_ET1_v = private unnamed_addr constant [37 x i8 ] c "_ZTS14name_generatorIL_Z9id_composEE\00 " , align 1
35
35
@__builtin_unique_stable_name._Z27get_specialization_constantIL_Z10id_compos2E17specialization_idI12ComposConst2ES1_ET1_v = private unnamed_addr constant [39 x i8 ] c "_ZTS14name_generatorIL_Z10id_compos2EE\00 " , align 1
36
36
37
37
; CHECK-LABEL: define dso_local void @_Z4testv
38
38
define dso_local void @_Z4testv () local_unnamed_addr #0 {
39
39
entry:
40
- %call.i = tail call fast double @_Z37__sycl_getScalar2020SpecConstantValueIdET_PKcPvS3_ (i8* getelementptr inbounds ([37 x i8 ], [37 x i8 ]* @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z9id_doubleE17specialization_idIdEdET1_v , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id* @id_double to i8* ), i8* null )
40
+ %call.i = tail call fast half @_Z37__sycl_getScalar2020SpecConstantValueIDhET_PKcPvS3_ (i8* getelementptr inbounds ([35 x i8 ], [35 x i8 ]* @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z9id_halfE17specialization_idIdEdET1_v , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id* @id_half to i8* ), i8* null )
41
41
; CHECK-DEF: %[[GEP:[0-9a-z]+]] = getelementptr i8, i8* null, i32 0
42
- ; CHECK-DEF: %[[BITCAST:[0-9a-z]+]] = bitcast i8* %[[GEP]] to double *
43
- ; CHECK-DEF: %[[LOAD:[0-9a-z]+]] = load double, double * %[[BITCAST]], align 8
42
+ ; CHECK-DEF: %[[BITCAST:[0-9a-z]+]] = bitcast i8* %[[GEP]] to half *
43
+ ; CHECK-DEF: %[[LOAD:[0-9a-z]+]] = load half, half * %[[BITCAST]], align 2
44
44
;
45
- ; CHECK-RT: call double @_Z20__spirv_SpecConstantid (i32 [[#SCID0:]], double 3.140000e+00 )
45
+ ; CHECK-RT: call half @_Z20__spirv_SpecConstantiDh (i32 [[#SCID0:]], half 0xH4000 )
46
46
47
47
%call.i3 = tail call i32 @_Z37__sycl_getScalar2020SpecConstantValueIiET_PKcPvS3_ (i8* getelementptr inbounds ([34 x i8 ], [34 x i8 ]* @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z6id_intE17specialization_idIiEiET1_v , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id.0* @id_int to i8* ), i8* null )
48
- ; CHECK-DEF: %[[GEP1:[0-9a-z]+]] = getelementptr i8, i8* null, i32 8
48
+ ; CHECK-DEF: %[[GEP1:[0-9a-z]+]] = getelementptr i8, i8* null, i32 2
49
49
; CHECK-DEF: %[[BITCAST1:[0-9a-z]+]] = bitcast i8* %[[GEP1]] to i32*
50
50
; CHECK-DEF: %[[LOAD1:[0-9a-z]+]] = load i32, i32* %[[BITCAST1]], align 4
51
51
;
52
52
; CHECK-RT: call i32 @_Z20__spirv_SpecConstantii(i32 [[#SCID1:]], i32 42)
53
53
54
- %call.i4 = tail call fast double @_Z37__sycl_getScalar2020SpecConstantValueIdET_PKcPvS3_ (i8* getelementptr inbounds ([37 x i8 ], [37 x i8 ]* @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z9id_doubleE17specialization_idIdEdET1_v , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id* @id_double to i8* ), i8* null )
54
+ %call.i4 = tail call fast half @_Z37__sycl_getScalar2020SpecConstantValueIDhET_PKcPvS3_ (i8* getelementptr inbounds ([35 x i8 ], [35 x i8 ]* @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z9id_halfE17specialization_idIdEdET1_v , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id* @id_half to i8* ), i8* null )
55
55
; CHECK-DEF: %[[GEP2:[0-9a-z]+]] = getelementptr i8, i8* null, i32 0
56
- ; CHECK-DEF: %[[BITCAST2:[0-9a-z]+]] = bitcast i8* %[[GEP2]] to double *
57
- ; CHECK-DEF: %[[LOAD2:[0-9a-z]+]] = load double, double * %[[BITCAST2]], align 8
56
+ ; CHECK-DEF: %[[BITCAST2:[0-9a-z]+]] = bitcast i8* %[[GEP2]] to half *
57
+ ; CHECK-DEF: %[[LOAD2:[0-9a-z]+]] = load half, half * %[[BITCAST2]], align 2
58
58
;
59
- ; CHECK-RT: call double @_Z20__spirv_SpecConstantid (i32 [[#SCID0]], double 3.140000e+00 )
59
+ ; CHECK-RT: call half @_Z20__spirv_SpecConstantiDh (i32 [[#SCID0]], half 0xH4000 )
60
60
ret void
61
61
}
62
62
69
69
%0 = bitcast %struct.ComposConst* %tmp to i8*
70
70
call void @llvm.lifetime.start.p0i8 (i64 24 , i8* nonnull %0 ) #3
71
71
call void @_Z40__sycl_getComposite2020SpecConstantValueI11ComposConstET_PKcPvS4_ (%struct.ComposConst* nonnull sret (%struct.ComposConst ) align 8 %tmp , i8* getelementptr inbounds ([37 x i8 ], [37 x i8 ]* @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z9id_composE17specialization_idI11ComposConstES1_ET1_v , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id.1* @id_compos to i8* ), i8* null )
72
- ; CHECK-DEF: %[[GEP:[0-9a-z]+]] = getelementptr i8, i8* null, i32 12
72
+ ; CHECK-DEF: %[[GEP:[0-9a-z]+]] = getelementptr i8, i8* null, i32 6
73
73
; CHECK-DEF: %[[BITCAST:[0-9a-z]+]] = bitcast i8* %[[GEP]] to %struct.ComposConst*
74
74
; CHECK-DEF: %[[C1:[0-9a-z]+]] = load %struct.ComposConst, %struct.ComposConst* %[[BITCAST]], align 8
75
75
;
86
86
%1 = getelementptr inbounds %struct.ComposConst2 , %struct.ComposConst2* %tmp1 , i64 0 , i32 0
87
87
call void @llvm.lifetime.start.p0i8 (i64 24 , i8* nonnull %1 ) #3
88
88
call void @_Z40__sycl_getComposite2020SpecConstantValueI12ComposConst2ET_PKcPvS4_ (%struct.ComposConst2* nonnull sret (%struct.ComposConst2 ) align 8 %tmp1 , i8* getelementptr inbounds ([39 x i8 ], [39 x i8 ]* @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z10id_compos2E17specialization_idI12ComposConst2ES1_ET1_v , i64 0 , i64 0 ), i8* getelementptr inbounds (%class.specialization_id.2 , %class.specialization_id.2* @id_compos2 , i64 0 , i32 0 , i32 0 ), i8* null ) call void @llvm.lifetime.end.p0i8 (i64 24 , i8* nonnull %1 ) #3
89
- ; CHECK-DEF: %[[GEP1:[0-9a-z]+]] = getelementptr i8, i8* null, i32 36
89
+ ; CHECK-DEF: %[[GEP1:[0-9a-z]+]] = getelementptr i8, i8* null, i32 30
90
90
; CHECK-DEF: %[[BITCAST1:[0-9a-z]+]] = bitcast i8* %[[GEP1]] to %struct.ComposConst2*
91
91
; CHECK-DEF: %[[C2:[0-9a-z]+]] = load %struct.ComposConst2, %struct.ComposConst2* %[[BITCAST1]], align 8
92
92
;
@@ -102,7 +102,7 @@ entry:
102
102
%2 = bitcast %struct.ComposConst* %tmp2 to i8*
103
103
call void @llvm.lifetime.start.p0i8 (i64 24 , i8* nonnull %2 ) #3
104
104
call void @_Z40__sycl_getComposite2020SpecConstantValueI11ComposConstET_PKcPvS4_ (%struct.ComposConst* nonnull sret (%struct.ComposConst ) align 8 %tmp2 , i8* getelementptr inbounds ([37 x i8 ], [37 x i8 ]* @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z9id_composE17specialization_idI11ComposConstES1_ET1_v , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id.1* @id_compos to i8* ), i8* null )
105
- ; CHECK-DEF: %[[GEP2:[0-9a-z]+]] = getelementptr i8, i8* null, i32 12
105
+ ; CHECK-DEF: %[[GEP2:[0-9a-z]+]] = getelementptr i8, i8* null, i32 6
106
106
; CHECK-DEF: %[[BITCAST2:[0-9a-z]+]] = bitcast i8* %[[GEP2]] to %struct.ComposConst*
107
107
; CHECK-DEF: %[[C3:[0-9a-z]+]] = load %struct.ComposConst, %struct.ComposConst* %[[BITCAST2]], align 8
108
108
;
@@ -123,6 +123,8 @@ declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
123
123
124
124
declare dso_local double @_Z37__sycl_getScalar2020SpecConstantValueIdET_PKcPvS3_ (i8* , i8* , i8* ) local_unnamed_addr #1
125
125
126
+ declare dso_local half @_Z37__sycl_getScalar2020SpecConstantValueIDhET_PKcPvS3_ (i8* , i8* , i8* ) local_unnamed_addr #1
127
+
126
128
declare dso_local i32 @_Z37__sycl_getScalar2020SpecConstantValueIiET_PKcPvS3_ (i8* , i8* , i8* ) local_unnamed_addr #1
127
129
128
130
declare dso_local void @_Z40__sycl_getComposite2020SpecConstantValueI11ComposConstET_PKcPvS4_ (%struct.ComposConst* sret (%struct.ComposConst ) align 8 , i8* , i8* , i8* ) local_unnamed_addr #2
@@ -139,7 +141,7 @@ attributes #3 = { nounwind }
139
141
; CHECK-DEF: !sycl.specialization-constants-default-values = !{![[#ID4:]], ![[#ID5:]], ![[#ID6:]], ![[#ID7:]]}
140
142
; CHECK-RT-NOT: !sycl.specialization-constants-default-values
141
143
;
142
- ; CHECK: ![[#ID0]] = !{!"_ZTS14name_generatorIL_Z9id_doubleEE ", i32 0, i32 0, i32 8 }
144
+ ; CHECK: ![[#ID0]] = !{!"_ZTS14name_generatorIL_Z9id_halfEE ", i32 0, i32 0, i32 2 }
143
145
; CHECK: ![[#ID1]] = !{!"_ZTS14name_generatorIL_Z6id_intEE", i32 1, i32 0, i32 4}
144
146
;
145
147
; For composite types, the amount of metadata is a bit different between native and emulated spec constants
@@ -156,7 +158,7 @@ attributes #3 = { nounwind }
156
158
; CHECK-RT-SAME: i32 [[#SCID8]], i32 8, i32 4,
157
159
; CHECK-RT-SAME: i32 [[#SCID9]], i32 16, i32 8}
158
160
;
159
- ; CHECK-DEF: ![[#ID4]] = !{double 3.140000e+00 }
161
+ ; CHECK-DEF: ![[#ID4]] = !{half 0xH4000 }
160
162
; CHECK-DEF: ![[#ID5]] = !{i32 42}
161
163
; CHECK-DEF: ![[#ID6]] = !{%struct.ComposConst { i32 1, double 2.000000e+00, %struct.myConst { i32 13, float 0x4020666660000000 } }}
162
164
; CHECK-DEF: ![[#ID7]] = !{%struct.ComposConst2 { i8 1, %struct.myConst { i32 52, float 0x40479999A0000000 }, double 2.000000e+00 }}
0 commit comments