- Value *Tmp8 = new ShiftInst(Instruction::Shl, V,
- ConstantInt::get(Type::UByteTy,56),"bswap.8", IP);
- Value *Tmp7 = new ShiftInst(Instruction::Shl, V,
- ConstantInt::get(Type::UByteTy,40),"bswap.7", IP);
- Value *Tmp6 = new ShiftInst(Instruction::Shl, V,
- ConstantInt::get(Type::UByteTy,24),"bswap.6", IP);
- Value *Tmp5 = new ShiftInst(Instruction::Shl, V,
- ConstantInt::get(Type::UByteTy,8),"bswap.5", IP);
- Value* Tmp4 = new ShiftInst(Instruction::LShr, V,
- ConstantInt::get(Type::UByteTy,8),"bswap.4", IP);
- Value* Tmp3 = new ShiftInst(Instruction::LShr, V,
- ConstantInt::get(Type::UByteTy,24),"bswap.3", IP);
- Value* Tmp2 = new ShiftInst(Instruction::LShr, V,
- ConstantInt::get(Type::UByteTy,40),"bswap.2", IP);
- Value* Tmp1 = new ShiftInst(Instruction::LShr, V,
- ConstantInt::get(Type::UByteTy,56),"bswap.1", IP);
- Tmp7 = BinaryOperator::createAnd(Tmp7,
- ConstantInt::get(Type::ULongTy,
- 0xFF000000000000ULL),
- "bswap.and7", IP);
- Tmp6 = BinaryOperator::createAnd(Tmp6,
- ConstantInt::get(Type::ULongTy, 0xFF0000000000ULL),
- "bswap.and6", IP);
- Tmp5 = BinaryOperator::createAnd(Tmp5,
- ConstantInt::get(Type::ULongTy, 0xFF00000000ULL),
- "bswap.and5", IP);
- Tmp4 = BinaryOperator::createAnd(Tmp4,
- ConstantInt::get(Type::ULongTy, 0xFF000000ULL),
- "bswap.and4", IP);
- Tmp3 = BinaryOperator::createAnd(Tmp3,
- ConstantInt::get(Type::ULongTy, 0xFF0000ULL),
- "bswap.and3", IP);
- Tmp2 = BinaryOperator::createAnd(Tmp2,
- ConstantInt::get(Type::ULongTy, 0xFF00ULL),
- "bswap.and2", IP);
- Tmp8 = BinaryOperator::createOr(Tmp8, Tmp7, "bswap.or1", IP);
- Tmp6 = BinaryOperator::createOr(Tmp6, Tmp5, "bswap.or2", IP);
- Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, "bswap.or3", IP);
- Tmp2 = BinaryOperator::createOr(Tmp2, Tmp1, "bswap.or4", IP);
- Tmp8 = BinaryOperator::createOr(Tmp8, Tmp6, "bswap.or5", IP);
- Tmp4 = BinaryOperator::createOr(Tmp4, Tmp2, "bswap.or6", IP);
- V = BinaryOperator::createOr(Tmp8, Tmp4, "bswap.i64", IP);
+ Value *Tmp8 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 56),
+ "bswap.8");
+ Value *Tmp7 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 40),
+ "bswap.7");
+ Value *Tmp6 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 24),
+ "bswap.6");
+ Value *Tmp5 = Builder.CreateShl(V, ConstantInt::get(V->getType(), 8),
+ "bswap.5");
+ Value* Tmp4 = Builder.CreateLShr(V, ConstantInt::get(V->getType(), 8),
+ "bswap.4");
+ Value* Tmp3 = Builder.CreateLShr(V,
+ ConstantInt::get(V->getType(), 24),
+ "bswap.3");
+ Value* Tmp2 = Builder.CreateLShr(V,
+ ConstantInt::get(V->getType(), 40),
+ "bswap.2");
+ Value* Tmp1 = Builder.CreateLShr(V,
+ ConstantInt::get(V->getType(), 56),
+ "bswap.1");
+ Tmp7 = Builder.CreateAnd(Tmp7,
+ ConstantInt::get(Type::Int64Ty,
+ 0xFF000000000000ULL),
+ "bswap.and7");
+ Tmp6 = Builder.CreateAnd(Tmp6,
+ ConstantInt::get(Type::Int64Ty,
+ 0xFF0000000000ULL),
+ "bswap.and6");
+ Tmp5 = Builder.CreateAnd(Tmp5,
+ ConstantInt::get(Type::Int64Ty, 0xFF00000000ULL),
+ "bswap.and5");
+ Tmp4 = Builder.CreateAnd(Tmp4,
+ ConstantInt::get(Type::Int64Ty, 0xFF000000ULL),
+ "bswap.and4");
+ Tmp3 = Builder.CreateAnd(Tmp3,
+ ConstantInt::get(Type::Int64Ty, 0xFF0000ULL),
+ "bswap.and3");
+ Tmp2 = Builder.CreateAnd(Tmp2,
+ ConstantInt::get(Type::Int64Ty, 0xFF00ULL),
+ "bswap.and2");
+ Tmp8 = Builder.CreateOr(Tmp8, Tmp7, "bswap.or1");
+ Tmp6 = Builder.CreateOr(Tmp6, Tmp5, "bswap.or2");
+ Tmp4 = Builder.CreateOr(Tmp4, Tmp3, "bswap.or3");
+ Tmp2 = Builder.CreateOr(Tmp2, Tmp1, "bswap.or4");
+ Tmp8 = Builder.CreateOr(Tmp8, Tmp6, "bswap.or5");
+ Tmp4 = Builder.CreateOr(Tmp4, Tmp2, "bswap.or6");
+ V = Builder.CreateOr(Tmp8, Tmp4, "bswap.i64");