@@ -593,7 +593,25 @@ llvm::Value *InstructionLifter::LiftRegisterOperand(Instruction &inst,
593593 auto arg_size = data_layout.getTypeAllocSizeInBits (arg_type);
594594
595595 if (val_size < arg_size) {
596+ // Because of using the latest version of Intex XED we support (which is currently v2025.06.08),
597+ // it reports XMM/YMM registers as vectors instead of integers. When remills tries to extend/truncate
598+ // these values we'll bitcast those vectors into integers
596599 if (arg_type->isIntegerTy ()) {
600+ if (val_type->isVectorTy ()) {
601+ auto int_type = llvm::Type::getIntNTy (module ->getContext (), val_size);
602+ val = new llvm::BitCastInst (val, int_type, llvm::Twine::createNull (), block);
603+
604+ val_type = int_type;
605+ } else if (val_type->isArrayTy ()) {
606+ // Arrays cannot be bitcast directly. Store to memory, bitcast pointer, then load.
607+ auto int_type = llvm::Type::getIntNTy (module ->getContext (), val_size);
608+ auto temp_alloca = new llvm::AllocaInst (val_type, 0 , llvm::Twine::createNull (), block);
609+ new llvm::StoreInst (val, temp_alloca, block);
610+ auto int_ptr = new llvm::BitCastInst (temp_alloca, llvm::PointerType::get (int_type, 0 ),
611+ llvm::Twine::createNull (), block);
612+ val = new llvm::LoadInst (int_type, int_ptr, llvm::Twine::createNull (), block);
613+ val_type = int_type;
614+ }
597615 CHECK (val_type->isIntegerTy ())
598616 << " Expected " << arch_reg.name << " to be an integral type ("
599617 << " val_type: " << LLVMThingToString (val_type) << " , "
@@ -616,6 +634,22 @@ llvm::Value *InstructionLifter::LiftRegisterOperand(Instruction &inst,
616634
617635 } else if (val_size > arg_size) {
618636 if (arg_type->isIntegerTy ()) {
637+ if (val_type->isVectorTy ()) {
638+ auto int_type = llvm::Type::getIntNTy (module ->getContext (), val_size);
639+ val = new llvm::BitCastInst (val, int_type, llvm::Twine::createNull (), block);
640+
641+ val_type = int_type;
642+ } else if (val_type->isArrayTy ()) {
643+ // Arrays cannot be bitcast directly. Store to memory, bitcast pointer, then load.
644+ auto int_type = llvm::Type::getIntNTy (module ->getContext (), val_size);
645+ auto temp_alloca = new llvm::AllocaInst (val_type, 0 , llvm::Twine::createNull (), block);
646+ new llvm::StoreInst (val, temp_alloca, block);
647+ auto int_ptr = new llvm::BitCastInst (temp_alloca, llvm::PointerType::get (int_type, 0 ),
648+ llvm::Twine::createNull (), block);
649+ val = new llvm::LoadInst (int_type, int_ptr, llvm::Twine::createNull (), block);
650+ val_type = int_type;
651+ }
652+
619653 CHECK (val_type->isIntegerTy ())
620654 << " Expected " << arch_reg.name << " to be an integral type ("
621655 << " val_type: " << LLVMThingToString (val_type) << " , "
0 commit comments