Skip to content

Commit d5958eb

Browse files
authored
[SYCL][ESIMD] Support device half type in intrinsics. (#4024)
Addition atop #3992 Signed-off-by: kbobrovs <[email protected]>
1 parent b4c322a commit d5958eb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

llvm/lib/SYCLLowerIR/LowerESIMD.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ Type *parsePrimitiveTypeString(StringRef TyStr, LLVMContext &Ctx) {
493493
.Case("unsigned", IntegerType::getInt32Ty(Ctx))
494494
.Case("unsigned long long", IntegerType::getInt64Ty(Ctx))
495495
.Case("long long", IntegerType::getInt64Ty(Ctx))
496+
.Case("_Float16", IntegerType::getHalfTy(Ctx))
496497
.Case("float", IntegerType::getFloatTy(Ctx))
497498
.Case("double", IntegerType::getDoubleTy(Ctx))
498499
.Case("void", IntegerType::getVoidTy(Ctx))

llvm/test/SYCLLowerIR/esimd_lower_intrins.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,18 @@ define dso_local spir_func void @FUNC_51() {
365365
ret void
366366
}
367367

368+
define dso_local spir_func <32 x half> @FUNC_52() {
369+
%ptr_a = alloca <32 x half>
370+
%ptr_b = alloca <32 x half>
371+
%ptr_c = alloca <32 x i16>
372+
%a = load <32 x half>, <32 x half>* %ptr_a
373+
%b = load <32 x half>, <32 x half>* %ptr_b
374+
%c = load <32 x i16>, <32 x i16>* %ptr_c
375+
%d = call spir_func <32 x half> @_Z16__esimd_wrregionIDF16_Li32ELi32ELi0ELi32ELi1ELi32EEN2cl4sycl3ext5intel12experimental5esimd6detail11vector_typeIT_XT0_EE4typeESA_NS7_IS8_XT1_EE4typeEtNS7_ItXT1_EE4typeE(<32 x half> %a, <32 x half> %b, i16 zeroext 0, <32 x i16> %c)
376+
; CHECK: %{{[0-9a-zA-Z_.]+}} = call <32 x half> @llvm.genx.wrregionf.v32f16.v32f16.i16.v32i1(<32 x half> %{{[0-9a-zA-Z_.]+}}, <32 x half> %{{[0-9a-zA-Z_.]+}}, i32 0, i32 32, i32 1, i16 0, i32 32, <32 x i1> %{{[0-9a-zA-Z_.]+}})
377+
ret <32 x half> %d
378+
}
379+
368380
declare dso_local i32 @_Z15__esimd_lane_idv()
369381

370382
declare dso_local spir_func <32 x i32> @_Z20__esimd_flat_atomic0ILN2cm3gen14CmAtomicOpTypeE2EjLi32ELNS1_9CacheHintE0ELS3_0EENS1_13__vector_typeIT0_XT1_EE4typeENS4_IyXT1_EE4typeENS4_ItXT1_EE4typeE(<32 x i64> %0, <32 x i16> %1)
@@ -414,6 +426,7 @@ declare dso_local spir_func <16 x float> @_Z12__esimd_rnduILi16EEN2cl4sycl3ext5i
414426
declare dso_local spir_func <16 x float> @_Z12__esimd_rndzILi16EEN2cl4sycl3ext5intel12experimental5esimd6detail11vector_typeIfXT_EE4typeES9_(<16 x float>)
415427
declare dso_local spir_func <16 x float> @_Z12__esimd_rndeILi16EEN2cl4sycl3ext5intel12experimental5esimd6detail11vector_typeIfXT_EE4typeES9_(<16 x float>)
416428
declare dso_local spir_func void @_Z25__esimd_test_src_tmpl_argILi3ELi5ELi7ELi11ELi13EEvv()
429+
declare dso_local spir_func <32 x half> @_Z16__esimd_wrregionIDF16_Li32ELi32ELi0ELi32ELi1ELi32EEN2cl4sycl3ext5intel12experimental5esimd6detail11vector_typeIT_XT0_EE4typeESA_NS7_IS8_XT1_EE4typeEtNS7_ItXT1_EE4typeE(<32 x half>, <32 x half>, i16 zeroext, <32 x i16>)
417430

418431
attributes #0 = { "genx_byte_offset"="192" "genx_volatile" }
419432

0 commit comments

Comments
 (0)