Skip to content

Commit

Permalink
Fix return type for fp16 vector comparison builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
StuartDBrady authored and svenvh committed Aug 5, 2019
1 parent 8d0498a commit 2a1efad
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/SPIRV/SPIRVReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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");
Expand Down

0 comments on commit 2a1efad

Please sign in to comment.