Skip to content

Commit 913231a

Browse files
authored
[llvm] Generate valid llvm IR for the DivRem intrinsics. (#92457)
1 parent 29a2ad1 commit 913231a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mono/mono/mini/mini-llvm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6698,7 +6698,7 @@ MONO_RESTORE_WARNING
66986698
case OP_X86_LDIVREM: {
66996699
const LLVMTypeRef part_type = ins->opcode==OP_X86_IDIVREM ? LLVMInt32Type () : LLVMInt64Type ();
67006700
const LLVMTypeRef full_type = ins->opcode==OP_X86_IDIVREM ? LLVMInt64Type () : LLVMInt128Type ();
6701-
const LLVMValueRef shift_amount = ins->opcode==OP_X86_IDIVREM ? const_int32 (32) : const_int32 (64);
6701+
const LLVMValueRef shift_amount = LLVMBuildZExt (builder, ins->opcode==OP_X86_IDIVREM ? const_int32 (32) : const_int32 (64), full_type, "");
67026702

67036703
LLVMValueRef dividend_low = LLVMBuildZExt (builder, convert (ctx, lhs, part_type), full_type, "");
67046704
LLVMValueRef dividend_high = LLVMBuildSExt (builder, convert (ctx, rhs, part_type), full_type, "");
@@ -6714,7 +6714,7 @@ MONO_RESTORE_WARNING
67146714
case OP_X86_LDIVREMU: {
67156715
const LLVMTypeRef part_type = ins->opcode==OP_X86_IDIVREMU ? LLVMInt32Type () : LLVMInt64Type ();
67166716
const LLVMTypeRef full_type = ins->opcode==OP_X86_IDIVREMU ? LLVMInt64Type () : LLVMInt128Type ();
6717-
const LLVMValueRef shift_amount = ins->opcode==OP_X86_IDIVREMU ? const_int32 (32) : const_int32 (64);
6717+
const LLVMValueRef shift_amount = LLVMBuildZExt (builder, ins->opcode==OP_X86_IDIVREMU ? const_int32 (32) : const_int32 (64), full_type, "");
67186718

67196719
LLVMValueRef dividend_low = LLVMBuildZExt (builder, convert (ctx, lhs, part_type), full_type, "");
67206720
LLVMValueRef dividend_high = LLVMBuildZExt (builder, convert (ctx, rhs, part_type), full_type, "");

0 commit comments

Comments
 (0)