search for: createuitofp

Displaying 7 results from an estimated 7 matches for "createuitofp".

Did you mean: createsitofp
2009 Jun 05
2
[LLVMdev] Int1 to Double Type Conversion
Hello, I would like to know if there is an instruction to convert values from the Int1 type to the Double type in LLVM. I would like to achieve the equivalent of casting a bool value to a double value in C++. Doing the simple CreateSIToFP or CreateUIToFP does not work, it throws an assertion ("invalid cast"). I simply want to avoid branching it's not necessary. What's the simplest way to achieve this? Thank you for your time, - Max -- View this message in context: http://www.nabble.com/Int1-to-Double-Type-Conversion-tp23895625p...
2009 Jun 05
0
[LLVMdev] Int1 to Double Type Conversion
...s.mcgill.ca> wrote: > > Hello, > > I would like to know if there is an instruction to convert values from the > Int1 type to the Double type in LLVM. I would like to achieve the equivalent > of casting a bool value to a double value in C++. Doing the simple > CreateSIToFP or CreateUIToFP does not work, it throws an assertion ("invalid > cast"). I simply want to avoid branching it's not necessary. What's the > simplest way to achieve this? The following LLVM assembly seems to compile just fine: define double @a(i1 zeroext %x) nounwind { %rval = uitofp i1 %x...
2007 Dec 17
0
[LLVMdev] Elsa and LLVM and LLVM submissions
...r > *Name = ""){ > + return CreateCast(Instruction::FPToUI, V, DestTy, Name); > + } > + Value *CreateFPToSI(Value *V, const Type *DestTy, const char > *Name = ""){ > + return CreateCast(Instruction::FPToSI, V, DestTy, Name); > + } > + Value *CreateUIToFP(Value *V, const Type *DestTy, const char > *Name = ""){ > + return CreateCast(Instruction::UIToFP, V, DestTy, Name); > + } > + Value *CreateSIToFP(Value *V, const Type *DestTy, const char > *Name = ""){ > + return CreateCast(Instruction::SIToFP, V,...
2007 Dec 17
2
[LLVMdev] Elsa and LLVM and LLVM submissions
Devang Patel wrote: > On Dec 15, 2007, at 12:15 PM, Richard Pennington wrote: > >> I got the current version of LLVM via svn yesterday and modified my >> code to >> use the LLVMFoldingBuilder. Very nice! >> >> My question is this: I noticed that the folding builder doesn't fold >> some >> operations, e.g. casts. Is there some reason why? If
2010 Feb 17
2
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
...tmp"); case '-': return Builder.CreateSub(L, R, "subtmp"); case '*': return Builder.CreateMul(L, R, "multmp"); case '<': L = Builder.CreateFCmpULT(L, R, "cmptmp"); // Convert bool 0/1 to double 0.0 or 1.0 return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), "booltmp"); default: return ErrorV("invalid binary operator"); } } Value *CallExprAST::Codegen() { // Look up the name in the global module table. Function *CalleeF = TheModule->getFunction(Callee); if (CalleeF == 0) re...
2010 Feb 17
0
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
...#39;-': return Builder.CreateSub(L, R, "subtmp"); > case '*': return Builder.CreateMul(L, R, "multmp"); > case '<': > L = Builder.CreateFCmpULT(L, R, "cmptmp"); > // Convert bool 0/1 to double 0.0 or 1.0 > return Builder.CreateUIToFP(L, > Type::getDoubleTy(getGlobalContext()), "booltmp"); > default: return ErrorV("invalid binary operator"); > } > } > > Value *CallExprAST::Codegen() { > // Look up the name in the global module table. > Function *CalleeF = TheModule->getFunction(...
2010 Feb 17
1
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
...uilder.CreateSub(L, R, "subtmp"); >>  case '*': return Builder.CreateMul(L, R, "multmp"); >>  case '<': >>    L = Builder.CreateFCmpULT(L, R, "cmptmp"); >>    // Convert bool 0/1 to double 0.0 or 1.0 >>    return Builder.CreateUIToFP(L, >> Type::getDoubleTy(getGlobalContext()), "booltmp"); >>  default: return ErrorV("invalid binary operator"); >>  } >> } >> >> Value *CallExprAST::Codegen() { >>  // Look up the name in the global module table. >>  Function *Call...