From 2a1efad8d3952615792e63dcea52cd2dd87468c5 Mon Sep 17 00:00:00 2001 From: Stuart Brady Date: Tue, 30 Jul 2019 20:26:06 +0100 Subject: [PATCH] Fix return type for fp16 vector comparison builtins --- lib/SPIRV/SPIRVReader.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/SPIRV/SPIRVReader.cpp b/lib/SPIRV/SPIRVReader.cpp index ed39614da8..109f6be899 100644 --- a/lib/SPIRV/SPIRVReader.cpp +++ b/lib/SPIRV/SPIRVReader.cpp @@ -1921,9 +1921,9 @@ Function *SPIRVToLLVM::transFunction(SPIRVFunction *BF) { /// LLVM convert builtin functions is translated to two instructions: /// y = i32 islessgreater(float x, float z) -> -/// y = i32 ZExt(bool LessGreater(float x, float z)) +/// y = i32 ZExt(bool LessOrGreater(float x, float z)) /// When translating back, for simplicity, a trunc instruction is inserted -/// w = bool LessGreater(float x, float z) -> +/// w = bool LessOrGreater(float x, float z) -> /// w = bool Trunc(i32 islessgreater(float x, float z)) /// Optimizer should be able to remove the redundant trunc/zext void SPIRVToLLVM::transOCLBuiltinFromInstPreproc( @@ -1939,9 +1939,7 @@ void SPIRVToLLVM::transOCLBuiltinFromInstPreproc( RetTy = VectorType::get( IntegerType::get( *Context, - Args[0]->getType()->getVectorComponentType()->isTypeFloat(64) - ? 64 - : 32), + Args[0]->getType()->getVectorComponentType()->getBitWidth()), BT->getVectorComponentCount()); else llvm_unreachable("invalid compare instruction");